s = str(eval(input()))

t = str(eval(input()))

d = {}

for k, v in zip(s, t):

    if d.get(k) != None and d.get(k) != v:

        print("No")

        exit()

    d[k] = v



if len(set(d.values())) == len(d):

    print("Yes")

else:

    print("No")
import sys



sys.setrecursionlimit(10 ** 7)

f_inf = float('inf')

mod = 10 ** 9 + 7





def resolve():

    S = eval(input())

    T = eval(input())



    dict = {}

    for s, t in zip(S, T):

        if dict.get(t) is not None and dict[t] != s:

            print("No")

            exit()

        else:

            dict[t] = s



    if len(set(dict.values())) == len(dict):

        print("Yes")

    else:

        print("No")





if __name__ == '__main__':

    resolve()

s = str(eval(input()))
t = str(eval(input()))
d = {}
for k, v in zip(s, t):
    if d.get(k) != None and d.get(k) != v:
        print("No")
        exit()
    d[k] = v
if len(set(d.values())) == len(d):
    print("Yes")
else:
    print("No")

import sys

sys.setrecursionlimit(10**7)
f_inf = float("inf")
mod = 10**9 + 7


def resolve():
    S = eval(input())
    T = eval(input())
    dict = {}
    for s, t in zip(S, T):
        if dict.get(t) is not None and dict[t] != s:
            print("No")
            exit()
        else:
            dict[t] = s
    if len(set(dict.values())) == len(dict):
        print("Yes")
    else:
        print("No")


if __name__ == "__main__":
    resolve()

-s = str(eval(input())) -t = str(eval(input())) -d = {} -for k, v in zip(s, t): -    if d.get(k) != None and d.get(k) != v: +import sys + +sys.setrecursionlimit(10**7) +f_inf = float("inf") +mod = 10**9 + 7 + + +def resolve(): +    S = eval(input()) +    T = eval(input()) +    dict = {} +    for s, t in zip(S, T): +        if dict.get(t) is not None and dict[t] != s: +            print("No") +            exit() +        else: +            dict[t] = s +    if len(set(dict.values())) == len(dict): +        print("Yes") +    else: -        exit() -    d[k] = v -if len(set(d.values())) == len(d): -    print("Yes") -else: -    print("No") + + +if __name__ == "__main__": +    resolve()