S = eval(input())

T = eval(input())



s_dict, t_dict = {}, {}



for i in range(len(S)):

    if S[i] in list(s_dict.keys()):

        if s_dict[S[i]] != T[i]:

            print("No")

            exit()

    else:

        s_dict[S[i]] = T[i]



    if T[i] in list(t_dict.keys()):

        if t_dict[T[i]] != S[i]:

            print("No")

            exit()

    else:

        t_dict[T[i]] = S[i]



print("Yes")

from collections import Counter

 

S = eval(input())

T = eval(input())

 

s = Counter(S)

t = Counter(T)

 

if sorted(s.values()) == sorted(t.values()):

    print("Yes")

else:

    print("No")

S = eval(input())
T = eval(input())
s_dict, t_dict = {}, {}
for i in range(len(S)):
    if S[i] in list(s_dict.keys()):
        if s_dict[S[i]] != T[i]:
            print("No")
            exit()
    else:
        s_dict[S[i]] = T[i]
    if T[i] in list(t_dict.keys()):
        if t_dict[T[i]] != S[i]:
            print("No")
            exit()
    else:
        t_dict[T[i]] = S[i]
print("Yes")

from collections import Counter

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

+from collections import Counter + -s_dict, t_dict = {}, {} -for i in range(len(S)): -    if S[i] in list(s_dict.keys()): -        if s_dict[S[i]] != T[i]: -            print("No") -            exit() -    else: -        s_dict[S[i]] = T[i] -    if T[i] in list(t_dict.keys()): -        if t_dict[T[i]] != S[i]: -            print("No") -            exit() -    else: -        t_dict[T[i]] = S[i] -print("Yes") +s = Counter(S) +t = Counter(T) +if sorted(s.values()) == sorted(t.values()): +    print("Yes") +else: +    print("No")