S, T = eval(input()), eval(input())



convert = dict()



answer = 'Yes'

for s, t in zip(S, T):

    if s in convert and convert[s] != t:

        answer = 'No'

        break

    else:

        convert[s] = t



after = list(convert.values())

if len(after) != len(set(after)):

    answer = 'No'



print(answer)
# coding: utf-8

import sys

from collections import Counter



sr = lambda: sys.stdin.readline().rstrip()

ir = lambda: int(sr())

lr = lambda: list(map(int, sr().split()))



S = sr()

T = sr()

cnt_S = Counter(S)

cnt_T = Counter(T)

num_S = sorted(list(cnt_S.values()))

num_T = sorted(list(cnt_T.values()))



bl = num_S == num_T

print(('Yes' if bl else 'No'))

S, T = eval(input()), eval(input())
convert = dict()
answer = "Yes"
for s, t in zip(S, T):
    if s in convert and convert[s] != t:
        answer = "No"
        break
    else:
        convert[s] = t
after = list(convert.values())
if len(after) != len(set(after)):
    answer = "No"
print(answer)

# coding: utf-8
import sys
from collections import Counter

sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))
S = sr()
T = sr()
cnt_S = Counter(S)
cnt_T = Counter(T)
num_S = sorted(list(cnt_S.values()))
num_T = sorted(list(cnt_T.values()))
bl = num_S == num_T
print(("Yes" if bl else "No"))

-S, T = eval(input()), eval(input()) -convert = dict() -answer = "Yes" -for s, t in zip(S, T): -    if s in convert and convert[s] != t: -        answer = "No" -        break -    else: -        convert[s] = t -after = list(convert.values()) -if len(after) != len(set(after)): -    answer = "No" -print(answer) +# coding: utf-8 +import sys +from collections import Counter + +sr = lambda: sys.stdin.readline().rstrip() +ir = lambda: int(sr()) +lr = lambda: list(map(int, sr().split())) +S = sr() +T = sr() +cnt_S = Counter(S) +cnt_T = Counter(T) +num_S = sorted(list(cnt_S.values())) +num_T = sorted(list(cnt_T.values())) +bl = num_S == num_T +print(("Yes" if bl else "No"))