S = eval(input())

T = eval(input())



def chr_count(S):

    count = [0]*1000

    for i in S:

        count[ord(i)] += 1

    return count



Sc = chr_count(S)

Tc = chr_count(T)

Sc.sort()

Tc.sort()



if Sc == Tc:

    print("Yes")

else:

    print("No")
from collections import Counter



S = eval(input())

T = eval(input())



s = sorted(list(Counter(S).values()))

t = sorted(list(Counter(T).values()))



if s == t:

    print("Yes")

else:

    print("No")
S = eval(input())
T = eval(input())


def chr_count(S):
    count = [0] * 1000
    for i in S:
        count[ord(i)] += 1
    return count


Sc = chr_count(S)
Tc = chr_count(T)
Sc.sort()
Tc.sort()
if Sc == Tc:
    print("Yes")
else:
    print("No")

from collections import Counter

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

+from collections import Counter + - - -def chr_count(S): -    count = [0] * 1000 -    for i in S: -        count[ord(i)] += 1 -    return count - - -Sc = chr_count(S) -Tc = chr_count(T) -Sc.sort() -Tc.sort() -if Sc == Tc: +s = sorted(list(Counter(S).values())) +t = sorted(list(Counter(T).values())) +if s == t: