S = eval(input())

T = eval(input())



used = []

res  = []



for i in range(len(S)):

    if S[i] not in used:

        used.append(S[i])

    res.append(used.index(S[i]))



#print(used)

#print(res)

used = []

ret = []



for i in range(len(T)):

    if T[i] not in used:

        used.append(T[i])

    ret.append(used.index(T[i]))



if res == ret:

    print('Yes')

else:

    print('No')
import sys

from collections import defaultdict



S = eval(input())

T = eval(input())

L = len(S)



dcts = defaultdict(int)

dctt = defaultdict(int)

for i in range(L):

    s = S[i]

    t = T[i]

    if dcts[s] == 0:

        dcts[s] = t

    else:

        if dcts[s] != t:

            print('No')

            sys.exit()

    if dctt[t] == 0:

        dctt[t] = s

    else:

        if dctt[t] != s:

            print('No')

            sys.exit()

print('Yes')
S = eval(input())
T = eval(input())
used = []
res = []
for i in range(len(S)):
    if S[i] not in used:
        used.append(S[i])
    res.append(used.index(S[i]))
# print(used)
# print(res)
used = []
ret = []
for i in range(len(T)):
    if T[i] not in used:
        used.append(T[i])
    ret.append(used.index(T[i]))
if res == ret:
    print("Yes")
else:
    print("No")

import sys
from collections import defaultdict

S = eval(input())
T = eval(input())
L = len(S)
dcts = defaultdict(int)
dctt = defaultdict(int)
for i in range(L):
    s = S[i]
    t = T[i]
    if dcts[s] == 0:
        dcts[s] = t
    else:
        if dcts[s] != t:
            print("No")
            sys.exit()
    if dctt[t] == 0:
        dctt[t] = s
    else:
        if dctt[t] != s:
            print("No")
            sys.exit()
print("Yes")

+import sys +from collections import defaultdict + -used = [] -res = [] -for i in range(len(S)): -    if S[i] not in used: -        used.append(S[i]) -    res.append(used.index(S[i])) -# print(used) -# print(res) -used = [] -ret = [] -for i in range(len(T)): -    if T[i] not in used: -        used.append(T[i]) -    ret.append(used.index(T[i])) -if res == ret: -    print("Yes") -else: -    print("No") +L = len(S) +dcts = defaultdict(int) +dctt = defaultdict(int) +for i in range(L): +    s = S[i] +    t = T[i] +    if dcts[s] == 0: +        dcts[s] = t +    else: +        if dcts[s] != t: +            print("No") +            sys.exit() +    if dctt[t] == 0: +        dctt[t] = s +    else: +        if dctt[t] != s: +            print("No") +            sys.exit() +print("Yes")