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

cnt1, cnt2, r1, r2 =[], [], [], []

for c in S:

    if not c in r1:

        cnt1.append(S.count(c))

        r1.append(c)

for c in T:

    if not c in r2:

        cnt2.append(T.count(c))

        r2.append(c)

#cnt1.sort()

#cnt2.sort()

if cnt1 == cnt2:

    print('Yes')

else:

    print('No')
from collections import Counter

if sorted(Counter(eval(input())).values()) == sorted(Counter(eval(input())).values()):

    print('Yes')

else:

    print('No')
S, T = eval(input()), eval(input())
cnt1, cnt2, r1, r2 = [], [], [], []
for c in S:
    if not c in r1:
        cnt1.append(S.count(c))
        r1.append(c)
for c in T:
    if not c in r2:
        cnt2.append(T.count(c))
        r2.append(c)
# cnt1.sort()
# cnt2.sort()
if cnt1 == cnt2:
    print("Yes")
else:
    print("No")

from collections import Counter

if sorted(Counter(eval(input())).values()) == sorted(Counter(eval(input())).values()):
    print("Yes")
else:
    print("No")

-S, T = eval(input()), eval(input()) -cnt1, cnt2, r1, r2 = [], [], [], [] -for c in S: -    if not c in r1: -        cnt1.append(S.count(c)) -        r1.append(c) -for c in T: -    if not c in r2: -        cnt2.append(T.count(c)) -        r2.append(c) -# cnt1.sort() -# cnt2.sort() -if cnt1 == cnt2: +from collections import Counter + +if sorted(Counter(eval(input())).values()) == sorted(Counter(eval(input())).values()):