from collections import Counter



s = list(eval(input()))

t = list(eval(input()))



cs = Counter(s)

ct = Counter(t)



csv = sorted(cs.values())

ctv = sorted(ct.values())



if csv == ctv:

    print("Yes")

    exit()



print("No")
from collections import Counter



s = Counter(eval(input()))

t = Counter(eval(input()))



sv = sorted(s.values())

tv = sorted(t.values())



if sv == tv:

    print("Yes")

    exit()



print("No")
from collections import Counter

s = list(eval(input()))
t = list(eval(input()))
cs = Counter(s)
ct = Counter(t)
csv = sorted(cs.values())
ctv = sorted(ct.values())
if csv == ctv:
    print("Yes")
    exit()
print("No")

from collections import Counter

s = Counter(eval(input()))
t = Counter(eval(input()))
sv = sorted(s.values())
tv = sorted(t.values())
if sv == tv:
    print("Yes")
    exit()
print("No")

-s = list(eval(input())) -t = list(eval(input())) -cs = Counter(s) -ct = Counter(t) -csv = sorted(cs.values()) -ctv = sorted(ct.values()) -if csv == ctv: +s = Counter(eval(input())) +t = Counter(eval(input())) +sv = sorted(s.values()) +tv = sorted(t.values()) +if sv == tv: