from collections import Counter

s=eval(input())

t=eval(input())



sc=Counter(s)

tc=Counter(t)

if len(sc)!=len(tc):

  print("No")

else:

  for s1,t1 in zip(sorted(list(sc.items()),key=lambda i: i[1]),sorted(list(tc.items()),key=lambda i: i[1])):

    if s1[1]!=t1[1]:

      print("No")

      break

  else:

    print("Yes")
from collections import Counter



sc=Counter(eval(input()))

tc=Counter(eval(input()))



for s,t in zip(sorted(sc.values()),sorted(tc.values())):

    if s!=t:

      print("No")

      break

else:

    print("Yes")
from collections import Counter

s = eval(input())
t = eval(input())
sc = Counter(s)
tc = Counter(t)
if len(sc) != len(tc):
    print("No")
else:
    for s1, t1 in zip(
        sorted(list(sc.items()), key=lambda i: i[1]),
        sorted(list(tc.items()), key=lambda i: i[1]),
    ):
        if s1[1] != t1[1]:
            print("No")
            break
    else:
        print("Yes")

from collections import Counter

sc = Counter(eval(input()))
tc = Counter(eval(input()))
for s, t in zip(sorted(sc.values()), sorted(tc.values())):
    if s != t:
        print("No")
        break
else:
    print("Yes")

-s = eval(input()) -t = eval(input()) -sc = Counter(s) -tc = Counter(t) -if len(sc) != len(tc): -    print("No") +sc = Counter(eval(input())) +tc = Counter(eval(input())) +for s, t in zip(sorted(sc.values()), sorted(tc.values())): +    if s != t: +        print("No") +        break -    for s1, t1 in zip( -        sorted(list(sc.items()), key=lambda i: i[1]), -        sorted(list(tc.items()), key=lambda i: i[1]), -    ): -        if s1[1] != t1[1]: -            print("No") -            break -    else: -        print("Yes") +    print("Yes")