import numpy as np



S = eval(input())

T = eval(input())



F = -np.ones(26,dtype=np.int)

G = -np.ones(26,dtype=np.int)

for i in range(len(S)):

    s = ord(S[i])-ord('a')

    t = ord(T[i])-ord('a')

    if F[s] < 0:

        F[s] = t

    elif F[s] != t:

        print('No')

        exit()



    if G[t] < 0:

        G[t] = s

    elif G[t] != s:

        print('No')

        exit()



print('Yes')
from collections import defaultdict

class CountUp:

    def __init__(self, start=0):

        self.index = start-1



    def __call__(self):

        self.index += 1

        return self.index



S = eval(input())

T = eval(input())

N = len(S)

Sdic = defaultdict(CountUp())

Tdic = defaultdict(CountUp())

for i in range(N):

    s = Sdic[S[i]]

    t = Tdic[T[i]]

    if s != t:

        print('No')

        break

else:

    print('Yes')
import numpy as np

S = eval(input())
T = eval(input())
F = -np.ones(26, dtype=np.int)
G = -np.ones(26, dtype=np.int)
for i in range(len(S)):
    s = ord(S[i]) - ord("a")
    t = ord(T[i]) - ord("a")
    if F[s] < 0:
        F[s] = t
    elif F[s] != t:
        print("No")
        exit()
    if G[t] < 0:
        G[t] = s
    elif G[t] != s:
        print("No")
        exit()
print("Yes")

from collections import defaultdict


class CountUp:
    def __init__(self, start=0):
        self.index = start - 1

    def __call__(self):
        self.index += 1
        return self.index


S = eval(input())
T = eval(input())
N = len(S)
Sdic = defaultdict(CountUp())
Tdic = defaultdict(CountUp())
for i in range(N):
    s = Sdic[S[i]]
    t = Tdic[T[i]]
    if s != t:
        print("No")
        break
else:
    print("Yes")

-import numpy as np +from collections import defaultdict + + +class CountUp: +    def __init__(self, start=0): +        self.index = start - 1 + +    def __call__(self): +        self.index += 1 +        return self.index + -F = -np.ones(26, dtype=np.int) -G = -np.ones(26, dtype=np.int) -for i in range(len(S)): -    s = ord(S[i]) - ord("a") -    t = ord(T[i]) - ord("a") -    if F[s] < 0: -        F[s] = t -    elif F[s] != t: +N = len(S) +Sdic = defaultdict(CountUp()) +Tdic = defaultdict(CountUp()) +for i in range(N): +    s = Sdic[S[i]] +    t = Tdic[T[i]] +    if s != t: -        exit() -    if G[t] < 0: -        G[t] = s -    elif G[t] != s: -        print("No") -        exit() -print("Yes") +        break +else: +    print("Yes")