s=list(eval(input()))

t=list(eval(input()))

S=sorted(map(s.count,set(s)))

T=sorted(map(t.count,set(t)))

print(("Yes" if S==T else "No"))
from collections import Counter

S=Counter(eval(input()))

T=Counter(eval(input()))

s=list(S.values())

t=list(T.values())

print(("Yes" if sorted(s)==sorted(t) else "No"))
s = list(eval(input()))
t = list(eval(input()))
S = sorted(map(s.count, set(s)))
T = sorted(map(t.count, set(t)))
print(("Yes" if S == T else "No"))

from collections import Counter

S = Counter(eval(input()))
T = Counter(eval(input()))
s = list(S.values())
t = list(T.values())
print(("Yes" if sorted(s) == sorted(t) else "No"))

-s = list(eval(input())) -t = list(eval(input())) -S = sorted(map(s.count, set(s))) -T = sorted(map(t.count, set(t))) -print(("Yes" if S == T else "No")) +from collections import Counter + +S = Counter(eval(input())) +T = Counter(eval(input())) +s = list(S.values()) +t = list(T.values()) +print(("Yes" if sorted(s) == sorted(t) else "No"))