import collections as c

s=eval(input())

t=eval(input())

d=c.defaultdict(list)

d2=c.defaultdict(list)

for k,v in enumerate(s):

    d[v].append(k)

for k,v in enumerate(t):

    d2[v].append(k)

a=set(tuple(i) for i in list(d.values()))

b=set(tuple(i) for i in list(d2.values()))

if a==b:

    print("Yes")

else:

    print("No")
from collections import*

s=enumerate(eval(input()))

t=enumerate(eval(input()))

d1=defaultdict(list)

d2=defaultdict(list)

for k,v in s:

    d1[v].append(k)

for k,v in t:

    d2[v].append(k)

print((["No","Yes"][set(tuple(i)for i in list(d1.values()))==set(tuple(i)for i in list(d2.values()))]))
import collections as c

s = eval(input())
t = eval(input())
d = c.defaultdict(list)
d2 = c.defaultdict(list)
for k, v in enumerate(s):
    d[v].append(k)
for k, v in enumerate(t):
    d2[v].append(k)
a = set(tuple(i) for i in list(d.values()))
b = set(tuple(i) for i in list(d2.values()))
if a == b:
    print("Yes")
else:
    print("No")

from collections import *

s = enumerate(eval(input()))
t = enumerate(eval(input()))
d1 = defaultdict(list)
d2 = defaultdict(list)
for k, v in s:
    d1[v].append(k)
for k, v in t:
    d2[v].append(k)
print(
    (
        ["No", "Yes"][
            set(tuple(i) for i in list(d1.values()))
            == set(tuple(i) for i in list(d2.values()))
        ]
    )
)

-import collections as c +from collections import * -s = eval(input()) -t = eval(input()) -d = c.defaultdict(list) -d2 = c.defaultdict(list) -for k, v in enumerate(s): -    d[v].append(k) -for k, v in enumerate(t): +s = enumerate(eval(input())) +t = enumerate(eval(input())) +d1 = defaultdict(list) +d2 = defaultdict(list) +for k, v in s: +    d1[v].append(k) +for k, v in t: -a = set(tuple(i) for i in list(d.values())) -b = set(tuple(i) for i in list(d2.values())) -if a == b: -    print("Yes") -else: -    print("No") +print( +    ( +        ["No", "Yes"][ +            set(tuple(i) for i in list(d1.values())) +            == set(tuple(i) for i in list(d2.values())) +        ] +    ) +)