from collections import defaultdict



S = eval(input())

T = eval(input())



ds = defaultdict(set)

for k, c in enumerate(S):

    ds[c] |= {k}

dt = defaultdict(set)

for k, c in enumerate(T):

    dt[c] |= {k}



dss = set(tuple(x) for x in list(ds.values()))

dts = set(tuple(x) for x in list(dt.values()))



print(('Yes' if dss ^ dts == set() else 'No'))
from collections import defaultdict

start = defaultdict(lambda: -1)

goal = defaultdict(lambda: -1)

for s, t in zip(eval(input()), eval(input())):

    if start[s] != -1 or goal[t] != -1:

        if start[s] != t or goal[t] != s:

            print('No')

            exit()

    start[s], goal[t] = t, s

print('Yes')
from collections import defaultdict

S = eval(input())
T = eval(input())
ds = defaultdict(set)
for k, c in enumerate(S):
    ds[c] |= {k}
dt = defaultdict(set)
for k, c in enumerate(T):
    dt[c] |= {k}
dss = set(tuple(x) for x in list(ds.values()))
dts = set(tuple(x) for x in list(dt.values()))
print(("Yes" if dss ^ dts == set() else "No"))

from collections import defaultdict

start = defaultdict(lambda: -1)
goal = defaultdict(lambda: -1)
for s, t in zip(eval(input()), eval(input())):
    if start[s] != -1 or goal[t] != -1:
        if start[s] != t or goal[t] != s:
            print("No")
            exit()
    start[s], goal[t] = t, s
print("Yes")

-S = eval(input()) -T = eval(input()) -ds = defaultdict(set) -for k, c in enumerate(S): -    ds[c] |= {k} -dt = defaultdict(set) -for k, c in enumerate(T): -    dt[c] |= {k} -dss = set(tuple(x) for x in list(ds.values())) -dts = set(tuple(x) for x in list(dt.values())) -print(("Yes" if dss ^ dts == set() else "No")) +start = defaultdict(lambda: -1) +goal = defaultdict(lambda: -1) +for s, t in zip(eval(input()), eval(input())): +    if start[s] != -1 or goal[t] != -1: +        if start[s] != t or goal[t] != s: +            print("No") +            exit() +    start[s], goal[t] = t, s +print("Yes")