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

str = "abcdefghijklmnopqrstuvwxyz"

dic,dic2 = [[] for _ in str],[[] for _ in str]

for i in range(len(S)):

    dic[str.index(S[i])].append(i)

for i in range(len(T)):

    dic2[str.index(T[i])].append(i)

dic.sort()

dic2.sort()

print(("Yes" if dic == dic2 else "No"))

from collections import Counter



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

Sc, Tc = Counter(S),Counter(T)

print(("Yes" if sorted(Sc.values()) == sorted(Tc.values()) else "No"))
S, T = eval(input()), eval(input())
str = "abcdefghijklmnopqrstuvwxyz"
dic, dic2 = [[] for _ in str], [[] for _ in str]
for i in range(len(S)):
    dic[str.index(S[i])].append(i)
for i in range(len(T)):
    dic2[str.index(T[i])].append(i)
dic.sort()
dic2.sort()
print(("Yes" if dic == dic2 else "No"))

from collections import Counter

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

+from collections import Counter + -str = "abcdefghijklmnopqrstuvwxyz" -dic, dic2 = [[] for _ in str], [[] for _ in str] -for i in range(len(S)): -    dic[str.index(S[i])].append(i) -for i in range(len(T)): -    dic2[str.index(T[i])].append(i) -dic.sort() -dic2.sort() -print(("Yes" if dic == dic2 else "No")) +Sc, Tc = Counter(S), Counter(T) +print(("Yes" if sorted(Sc.values()) == sorted(Tc.values()) else "No"))