S = eval(input())

T = eval(input())



Sd = {}

Sl = []

for c in S:

    if c not in Sd:

        Sd[c] = len(Sd)

    Sl.append(Sd[c])



Td = {}

Tl = []

for c in T:

    if c not in Td:

        Td[c] = len(Td)

    Tl.append(Td[c])



print(('Yes' if Sl == Tl else 'No'))

def convert(st):

    d = {}

    lst = []

    for ch in st:

        if ch not in d:

            d[ch] = len(d)

        lst.append(d[ch])

    return lst





S = eval(input())

T = eval(input())

Sl = convert(S)

Tl = convert(T)

print(('Yes' if Sl == Tl else 'No'))
S = eval(input())
T = eval(input())
Sd = {}
Sl = []
for c in S:
    if c not in Sd:
        Sd[c] = len(Sd)
    Sl.append(Sd[c])
Td = {}
Tl = []
for c in T:
    if c not in Td:
        Td[c] = len(Td)
    Tl.append(Td[c])
print(("Yes" if Sl == Tl else "No"))

def convert(st):
    d = {}
    lst = []
    for ch in st:
        if ch not in d:
            d[ch] = len(d)
        lst.append(d[ch])
    return lst


S = eval(input())
T = eval(input())
Sl = convert(S)
Tl = convert(T)
print(("Yes" if Sl == Tl else "No"))

+def convert(st): +    d = {} +    lst = [] +    for ch in st: +        if ch not in d: +            d[ch] = len(d) +        lst.append(d[ch]) +    return lst + + -Sd = {} -Sl = [] -for c in S: -    if c not in Sd: -        Sd[c] = len(Sd) -    Sl.append(Sd[c]) -Td = {} -Tl = [] -for c in T: -    if c not in Td: -        Td[c] = len(Td) -    Tl.append(Td[c]) +Sl = convert(S) +Tl = convert(T)