from collections import Counter



S = eval(input())

T = eval(input())



lenS = len(Counter(S))

lenT = len(Counter(T))

flag = 0



if lenS == lenT:

    for i in range(lenS):

        if Counter(S).most_common()[i][1] == Counter(T).most_common()[i][1]:

            continue

        else:

            flag = 1

            break

else:

    flag = 1

    

if flag == 0:

    print('Yes')

else:

    print('No')
from collections import Counter



S = sorted(Counter(eval(input())).values())

T = sorted(Counter(eval(input())).values())



if S == T:

    print('Yes')

else:

    print('No')
from collections import Counter

S = eval(input())
T = eval(input())
lenS = len(Counter(S))
lenT = len(Counter(T))
flag = 0
if lenS == lenT:
    for i in range(lenS):
        if Counter(S).most_common()[i][1] == Counter(T).most_common()[i][1]:
            continue
        else:
            flag = 1
            break
else:
    flag = 1
if flag == 0:
    print("Yes")
else:
    print("No")

from collections import Counter

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

-S = eval(input()) -T = eval(input()) -lenS = len(Counter(S)) -lenT = len(Counter(T)) -flag = 0 -if lenS == lenT: -    for i in range(lenS): -        if Counter(S).most_common()[i][1] == Counter(T).most_common()[i][1]: -            continue -        else: -            flag = 1 -            break -else: -    flag = 1 -if flag == 0: +S = sorted(Counter(eval(input())).values()) +T = sorted(Counter(eval(input())).values()) +if S == T: