import sys

S=eval(input())

T=eval(input())

N=len(S)

L=['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z']

Ss=[]

Ts=[]

for x in L:

    A=set()

    B=set()

    for i in range(N):

        if S[i]==x:

            A.add(i)

        if T[i]==x:

            B.add(i)

    Ss.append(A)

    Ts.append(B)

for A in Ss:

    flag=True

    for B in Ts:

        if A==B:

            flag=False

    if flag:

        print('No')

        sys.exit()

print('Yes')
import sys

S=eval(input())

T=eval(input())

N=len(S)

a=ord('a')

R=[-1]*26

Q=[-1]*26

for i in range(N):

    s=ord(S[i])-a

    t=ord(T[i])-a

    if R[s]!=-1:

        if Q[t]!=R[s]:

            print('No')

            sys.exit()

    if Q[t]!=-1:

        if R[s]!=Q[t]:

            print('No')

            sys.exit()  

    if R[s]==-1:

        R[s]=i

    if Q[t]==-1:

        Q[t]=i

print('Yes')
import sys

S = eval(input())
T = eval(input())
N = len(S)
L = [
    "a",
    "b",
    "c",
    "d",
    "e",
    "f",
    "g",
    "h",
    "i",
    "j",
    "k",
    "l",
    "m",
    "n",
    "o",
    "p",
    "q",
    "r",
    "s",
    "t",
    "u",
    "v",
    "w",
    "x",
    "y",
    "z",
]
Ss = []
Ts = []
for x in L:
    A = set()
    B = set()
    for i in range(N):
        if S[i] == x:
            A.add(i)
        if T[i] == x:
            B.add(i)
    Ss.append(A)
    Ts.append(B)
for A in Ss:
    flag = True
    for B in Ts:
        if A == B:
            flag = False
    if flag:
        print("No")
        sys.exit()
print("Yes")

import sys

S = eval(input())
T = eval(input())
N = len(S)
a = ord("a")
R = [-1] * 26
Q = [-1] * 26
for i in range(N):
    s = ord(S[i]) - a
    t = ord(T[i]) - a
    if R[s] != -1:
        if Q[t] != R[s]:
            print("No")
            sys.exit()
    if Q[t] != -1:
        if R[s] != Q[t]:
            print("No")
            sys.exit()
    if R[s] == -1:
        R[s] = i
    if Q[t] == -1:
        Q[t] = i
print("Yes")

-L = [ -    "a", -    "b", -    "c", -    "d", -    "e", -    "f", -    "g", -    "h", -    "i", -    "j", -    "k", -    "l", -    "m", -    "n", -    "o", -    "p", -    "q", -    "r", -    "s", -    "t", -    "u", -    "v", -    "w", -    "x", -    "y", -    "z", -] -Ss = [] -Ts = [] -for x in L: -    A = set() -    B = set() -    for i in range(N): -        if S[i] == x: -            A.add(i) -        if T[i] == x: -            B.add(i) -    Ss.append(A) -    Ts.append(B) -for A in Ss: -    flag = True -    for B in Ts: -        if A == B: -            flag = False -    if flag: -        print("No") -        sys.exit() +a = ord("a") +R = [-1] * 26 +Q = [-1] * 26 +for i in range(N): +    s = ord(S[i]) - a +    t = ord(T[i]) - a +    if R[s] != -1: +        if Q[t] != R[s]: +            print("No") +            sys.exit() +    if Q[t] != -1: +        if R[s] != Q[t]: +            print("No") +            sys.exit() +    if R[s] == -1: +        R[s] = i +    if Q[t] == -1: +        Q[t] = i