You are given strings S and T consisting of lowercase English letters.
You can perform the following operation on S any number of times:
Operation: Choose two distinct lowercase English letters c_1 and c_2, then replace every occurrence of c_1 with c_2, and every occurrence of c_2 with c_1.
Determine if S and T can be made equal by performing the operation zero or more times.

-----Constraints-----
 - 1 \leq |S| \leq 2 \times 10^5
 - |S| = |T|
 - S and T consists of lowercase English letters.

-----Input-----
Input is given from Standard Input in the following format:
S
T

-----Output-----
If S and T can be made equal, print Yes; otherwise, print No.

-----Sample Input-----
azzel
apple

-----Sample Output-----
Yes

azzel can be changed to apple, as follows:
 - Choose e as c_1 and l as c_2. azzel becomes azzle.
 - Choose z as c_1 and p as c_2. azzle becomes apple.

Difficulty: introductory

Starter code:

Solutions:
S = input()
T = input()

s = [[] for i in range(26)]
t = [[] for i in range(26)]

for i in range(len(S)):
    s[ord(S[i])-97].append(i)
    t[ord(T[i])-97].append(i)

s = sorted(s)
t = sorted(t)
if s == t:
    print("Yes")
else:
    print("No")

S=input()
T=input()
d=[[] for i in range(26)]
for i,c in enumerate(S):
    d[ord(c)-ord('a')].append(i)
d2=[[]for i in range(26)]
for i,c in enumerate(T):
    d2[ord(c)-ord('a')].append(i)
print(['No','Yes'][set((tuple(x) for x in d))==set((tuple(x) for x in d2))])

S = input()
T = input()

chk1 = [[] for _ in range(26)]
chk2 = [[] for _ in range(26)]
for i in range(len(S)):
    s1 = ord(S[i]) - 97
    s2 = ord(T[i]) - 97
    if len(chk1[s1]) == 0:
        chk1[s1].append(T[i])
    else:
        if chk1[s1][0] == T[i]:
            pass
        else:
            print('No')
            return
    if len(chk2[s2]) == 0:
        chk2[s2].append(S[i])
    else:
        if chk2[s2][0] == S[i]:
            pass
        else:
            print('No')
            return    
print('Yes')

from collections import Counter
S = str(input())
T = str(input())

s = Counter(S)
t = Counter(T)

if sorted(s.values()) == sorted(t.values()):
  print('Yes')
else:
  print('No')

import sys
from collections import Counter


def main():
    s = input()
    t = input()
    s_count = [0]*26
    t_count = [0]*26
    for i in range(ord("a"), ord("z")+1):
        s_count[i-97] = s.count(chr(i))
        t_count[i-97] = t.count(chr(i))
    s_count.sort()
    t_count.sort()
    if s_count == t_count:
        print("Yes")
    else:
        print("No")


def __starting_point():
    main()

__starting_point()

s = input()
t = input()

sl = list(s)
tl = list(t)

from collections import Counter
sc = Counter(sl)
tc = Counter(tl)

sp =[]
tp =[]

alp = "abcdefghijklmnopqrstuvwxyz"

for i in alp:
    sp.append(sc[i])
    tp.append(tc[i])

sps =sorted(sp)
tps = sorted(tp)

for i,j in zip (sps,tps):
    if i ==j:
        pass
    else:
        print("No")
        return
print("Yes")

s = input()
t = input()
# sとtの文字が一対一に対応していれば良い
ds = {}
dt = {}

ans = 'Yes'
for S,T in zip(s,t):
    if S in ds:
        if ds[S] != T:
            ans = 'No'
            break
    else:
        ds[S] = T
    
    if T in dt:
        if dt[T] != S:
            ans = 'No'
            break
    else:
        dt[T] = S

print(ans)

from collections import Counter
s = list(input())
t = list(input())

s_count = Counter(s)
t_count = Counter(t)

# s,tそれぞれの各文字の出現回数が同じであれば一致させられる
if sorted(s_count.values()) == sorted(t_count.values()): print("Yes")
else: print("No")

s = input()
t = input()

l_s = [[] for _ in range(26)]

for i, x in enumerate(s):
    l_s[ord(x) - 97].append(i)

l_t = [[] for _ in range(26)]
for i, x in enumerate(t):
    l_t[ord(x) - 97].append(i)

for l in l_s:
    if len(l) > 0:
        if l_t[ord(t[l[0]]) - 97] != l:
            print('No')
            return

print('Yes')

from collections import Counter
s = [i for i in str(input())]
t = [h for h in str(input())]
s1 = Counter(s).most_common()
t1 = Counter(t).most_common()
if len(s1) != len(t1):
    print('No')
else:
    z = 'Yes'
    for j in range(len(s1)):
        if s1[j][1] != t1[j][1]:
            z = 'No'
            break
    print(z)

import collections

A = input()
B = input()

A_c = collections.Counter(A)
B_c = collections.Counter(B)
A_c = list(A_c.values())
B_c = list(B_c.values())

A_c = list(A_c)
B_c = list(B_c)
A_c.sort()
B_c.sort()
if A_c == B_c:
    print("Yes")
else:
    print("No")


s = list(input())
t = list(input())
n = len(s)

s_par = [i for i in range(n + 1)]
t_par = [i for i in range(n + 1)]

for i in range(n):
    for j in range(i):
        if s[i] == s[j]:
            s_par[i] = s_par[j]
            break
            
for i in range(n):
    for j in range(i):
        if t[i] == t[j]:
            t_par[i] = t_par[j]
            break
            
if s_par == t_par:
    print('Yes')
else:
    print('No')

# import sys
# sys.setrecursionlimit(10 ** 6)
# import bisect
# from collections import deque
# from decorator import stop_watch
#
#
# @stop_watch
def solve(S, T):
    alp = 'abcdefghijklmnopqrstuvwxyz'
    N = len(S)
    S_same = [[] for _ in range(N)]
    S_alphabet = {s: [] for s in alp}
    T_same = [[] for _ in range(N)]
    T_alphabet = {s: [] for s in alp}
    for i in range(N):
        S_alphabet[S[i]].append(i)
        T_alphabet[T[i]].append(i)
    for s in alp:
        stmp = S_alphabet[s]
        ttmp = T_alphabet[s]
        if len(stmp) > 0:
            S_same[stmp[0]] = stmp.copy()
        if len(ttmp) > 0:
            T_same[ttmp[0]] = ttmp.copy()
    for i in range(N):
        if len(S_same[i]) > 1:
            for ss in S_same[i][1:]:
                if T[S_same[i][0]] != T[ss]:
                    print('No')
                    return
        if len(T_same[i]) > 1:
            for tt in T_same[i][1:]:
                if S[T_same[i][0]] != S[tt]:
                    print('No')
                    return
    print('Yes')


def __starting_point():
    S = input()
    T = input()
    solve(S, T)

    # # test
    # from random import randint
    # from func import random_str
    # solve()

__starting_point()

import sys


def input():
    return sys.stdin.readline().rstrip()


def main():
    S = input()
    T = input()
    dictS =dict()
    dictT =dict()

    for i in range(len(S)):
        if S[i] in dictS:
            if dictS[S[i]] !=T[i]:
                print("No")
                return
        else:
            dictS[S[i]] =T[i]

        if T[i] in dictT:
            if dictT[T[i]] !=S[i]:
                print("No")
                return
        else:
            dictT[T[i]] =S[i]

    print("Yes")



def __starting_point():
    main()

__starting_point()

# chokudaiをredcorderにするのはなんとなくできそうなきがするがなんでできないのだろうか
# c->r, r->c = rhokudai
# i->r, r->I = ihokudar
# たしかに出来なかった
# つまり目的の文字にできるのはせいぜい1回まで
# （2回目以降はそれより前に変化させた文字に影響が出る）
# なので、各文字の登場回数を出し、その数だけで比較する
s, t = list(input()), list(input())
sd, td = {}, {}
for sv in s:
    if sv not in sd:
        sd[sv] = 1
    else:
        sd[sv] += 1
for tv in t:
    if tv not in td:
        td[tv] = 1
    else:
        td[tv] += 1
ss, ts = sorted(sd.values()), sorted(td.values())
if ss == ts:
    print("Yes")
else:
    print("No")


import collections 
s = input()
t = input()
sc = sorted(collections.Counter(s).values())
tc = sorted(collections.Counter(t).values())


for i in range(len(sc)):
  if sc[i] != tc[i]:
    print("No")
    return
print("Yes")


S=list(input())
T=list(input())
print("Yes" if len(set(S))==len(set(T))==len(set(zip(S,T))) else "No")

S = input()
T = input()
s = sorted(map(S.count, set(S)))
t = sorted(map(T.count, set(T)))
print(("Yes" if(s == t) else "No"))


s = input()
t = input()
x = []
y = []
for i in range(len(s)):
    if s[i] not in x:
        x.append(s[i])
    if t[i] not in y:
        y.append(t[i])
for i in range(len(x)):
    s = s.replace(x[i], str(i))
for i in range(len(y)):
    t = t.replace(y[i], str(i))
if s == t:
    print("Yes")
else:
    print("No")

S=input()
T=input()
N=len(S)
d=dict()
for i in range(N):
    if S[i] not in list(d.keys()):
        if T[i] in list(d.values()):
            print("No")
            break
        d[S[i]]=T[i]
    else:
        if d[S[i]]!=T[i]:
            print("No")
            break
else:
    print("Yes")


s = input()
t = input()

cycle_to = [''] * 26
cycle_from = [''] * 26

for i in range(len(s)):
    if cycle_to[ord(s[i]) - 97] == t[i]:
        continue
    if cycle_to[ord(s[i]) - 97] == '':
        cycle_to[ord(s[i]) - 97] = t[i]
    else:
        print('No')
        break
    
    if cycle_from[ord(t[i]) - 97] == s[i]:
        continue
    if cycle_from[ord(t[i]) - 97] == '':
        cycle_from[ord(t[i]) - 97] = s[i]
    else:
        print('No')
        break
else:
    print('Yes')

S = input()
T = input()
S_cnt = sorted(S.count(c) for c in set(S))
T_cnt = sorted(T.count(c) for c in set(T))
print("Yes") if S_cnt == T_cnt else print("No")


import collections
S = list(input())
T = list(input())
 
cntS = collections.Counter(S)
cntT = collections.Counter(T)
 
if len(cntS) != len(cntT):
    print('No')
    return
else:
    valS = list(cntS.values())
    valT = list(cntT.values())

    if valS != valT:
            print('No')
            return
print('Yes')

import collections
S = list(input())
T = list(input())
counterS = collections.Counter(S)
counterT = collections.Counter(T)
Scou = list(counterS.values())
Tcou = list(counterT.values())
Scou.sort()
Tcou.sort()
if Scou == Tcou:
    print('Yes')
else:
    print('No')


import math
from math import gcd,pi,sqrt
INF = float("inf")

import sys
sys.setrecursionlimit(10**6)
import itertools
from collections import Counter,deque
def i_input(): return int(input())
def i_map(): return list(map(int, input().split()))
def i_list(): return list(i_map())
def i_row(N): return [i_input() for _ in range(N)]
def i_row_list(N): return [i_list() for _ in range(N)]
def s_input(): return input()
def s_map(): return input().split()
def s_list(): return list(s_map())
def s_row(N): return [s_input for _ in range(N)]
def s_row_str(N): return [s_list() for _ in range(N)]
def s_row_list(N): return [list(s_input()) for _ in range(N)]


def main():
    s = input()
    t = input()
    import string

    l = string.ascii_lowercase

    for i in l:
        trial = set()
        for k,j in enumerate(s):
            if i == j:
                trial.add(t[k])
                if len(trial) > 1:
                    print("No")
                    return
        trial = set()
        for k,j in enumerate(t):
            if i == j:
                trial.add(s[k])
                if len(trial) > 1:
                    print("No")
                    return

    print("Yes")



def __starting_point():
    main()

__starting_point()

S = input()
T = input()
length = len(S)
keep_S = [[] for i in range(26)]  # ord(T[i])に対応する S を格納
keep_T = [[] for i in range(26)]  # ord(S[i])に対応する T を格納

for i in range(length):

    num_S = ord(T[i]) - ord('a')
    num_T = ord(S[i]) - ord('a')

    if S[i] in keep_S[num_S]:
        continue
    else:
        keep_S[num_S].append(S[i])

    if T[i] in keep_T[num_T]:
        continue
    else:
        keep_T[num_T].append(T[i])


for i in range(26):
    if (len(keep_T[i]) > 1) | (len(keep_S[i]) > 1):
        print('No')
        return
print('Yes')


import bisect,collections,copy,itertools,math,string
import sys
def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def S(): return sys.stdin.readline().rstrip()
def LS(): return list(sys.stdin.readline().rstrip().split())
def main():


    s = S()
    t = S()
    
    dic1 = collections.defaultdict(str)
    dic2 = collections.defaultdict(str)
    
    for i in range(len(s)):
        if dic1[t[i]] == "":
            dic1[t[i]] = s[i]
        else:
            if dic1[t[i]] != s[i]:
                print("No")
                return

        if dic2[s[i]] == "":
            dic2[s[i]] = t[i]
        else:
            if dic2[s[i]] != t[i]:
                print("No")
                return
        
    print("Yes")

main()


import sys
from collections import Counter

input = sys.stdin.readline


def main():
    S = input().rstrip()
    T = input().rstrip()

    c_S = Counter(S)
    c_T = Counter(T)
    count_S = list(c_S.values())
    count_T = list(c_T.values())
    count_S.sort()
    count_T.sort()
    is_same = True
    for s, t in zip(count_S, count_T):
        if s != t:
            is_same = False
            break

    ans = "Yes" if is_same else "No"
    print(ans)


def __starting_point():
    main()

__starting_point()

from collections import Counter

s = input()
t = input()

c1 = Counter(s).most_common()
c2 = Counter(t).most_common()

for x, y in zip(c1, c2):
    if x[1] != y[1]:
        print("No")
        break
else:
    print("Yes")

import sys


stdin = sys.stdin
def ns(): return stdin.readline().rstrip()
def ni(): return int(stdin.readline().rstrip())
def nm(): return list(map(int, stdin.readline().split()))
def nl(): return list(map(int, stdin.readline().split()))


def main():
    s = input()
    t = input()
    S = sorted(map(s.count, set(s)))
    T = sorted(map(t.count, set(t)))
    print(("Yes" if S == T else "No"))


def __starting_point():
    main()

__starting_point()

s=list(input())
t=list(input())

n=len(s)
ch=0
ch1=0
ans=0

d={}
d1={}

st=1
st1=1

s_new=[]
t_new=[]

for i in range(n):
  if s[i] not in d:
    d[s[i]]=st
    st+=1
    
for g in range(n):
  if t[g] not in d1:
    d1[t[g]]=st1
    st1+=1
    
for h in range(n):
  s_new.append(d[s[h]])
  t_new.append(d1[t[h]])
  
if s_new==t_new:
  print('Yes')
else:
  print('No')


S = input()
T = input()

alph = ['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']

S_counter = []
T_counter = []
for i in alph:
    S_counter.append(S.count(i))
    T_counter.append(T.count(i))

S_counter.sort()
T_counter.sort()

if S_counter == T_counter:
    print('Yes')
else:
    print('No')


import collections

S = input()
T = input()

S_c = sorted(list(collections.Counter(S).values()))
T_c = sorted(list(collections.Counter(T).values()))

print("Yes" if S_c == T_c else "No")

import collections
S = list(input())
T = list(input())
if sorted(collections.Counter(S).values()) == sorted(collections.Counter(T).values()):
    print("Yes")
else:
    print("No")

S = input()
T = input()

C_S = [None for _ in range(26)]
C_T = [None for _ in range(26)]

ok = True
for i in range(len(S)):
    if not C_S[ord(S[i]) - ord('a')]:
        C_S[ord(S[i]) - ord('a')] = T[i]
    else:
        if C_S[ord(S[i]) - ord('a')] != T[i]:
            ok = False
            break
    if not C_T[ord(T[i]) - ord('a')]:
        C_T[ord(T[i]) - ord('a')] = S[i]
    else:
        if C_T[ord(T[i]) - ord('a')] != S[i]:
            ok = False
            break
if ok:
    print("Yes")
else:
    print("No")


def p(S):
    D={}
    for i in range(len(S)):
        a=S[i]
        if a in D:
            D[a].add(i)
        else:
            D[a]={i}
    return D
S=input()
T=input()

A=sorted(p(S).values())
B=sorted(p(T).values())

if A==B:
    print("Yes")
else:
    print("No")


import collections
S = input()
T = input()
if sorted(collections.Counter(S).values()) == sorted(collections.Counter(T).values()):
    print("Yes")
else:
    print("No")


from collections import Counter

s = list(input())
t = list(input())

sc = Counter(s).values()
tc = Counter(t).values()

sl = Counter(sc)
tl = Counter(tc)

if sl == tl:
    print('Yes')
else:
    print('No')

S = input()
T = input()
N = len(S)
count = 0
R_1 = [-1 for i in range(26)]
R_2 = [-1 for i in range(26)]

answer = "Yes"
for i in range(N):
    r1 = ord(S[i]) - 97
    r2 = ord(T[i]) - 97
    if R_1[r1] >= 0:
        if r2 != R_1[r1]:
            answer = "No"
            break
    if R_2[r2] >= 0:
        if r1 != R_2[r2]:
            answer = "No"
            break
    if R_1[r1] < 0:
        R_1[r1] = r2
    if R_2[r2] < 0:
        R_2[r2] = r1
print(answer)

from collections import Counter

s = input()
t = input()
# sとtの文字列をカウントして昇順にソート
ss = sorted(Counter(s).values())
st = sorted(Counter(t).values())
# アルファベットの種類数と要素数が同じならYes
print("Yes") if ss == st else print("No")


S = input()
T = input()
U = [[i,j] for i,j in zip(S,T)]
U.sort()
s = U[0][0]
t = U[0][1]
for i,j in U:
    if  i != s:
        s = i
        t = j
    elif j != t:
        print("No")
        return
U.sort(key=lambda x:x[1])
s = U[0][0]
t = U[0][1]
for i,j in U:
    if j != t:
        s = i
        t = j
    elif i != s:
        print("No")
        return
print("Yes")

import sys

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007


def solve(S, T):
    d = dict()
    for s, t in zip(S, T):
        if s in d and d[s] != t:
            return False
        else:
            d[s] = t

    return True


def main():
    S = readline().strip()
    T = readline().strip()

    if solve(S, T) and solve(T, S):
        print('Yes')
    else:
        print('No')

    return


def __starting_point():
    main()

__starting_point()

s = input()
t = input()
cs = []
ct = []
for i in range(97,97+26):
  cs.append(s.count(chr(i)))
  ct.append(t.count(chr(i)))
if sorted(cs) == sorted(ct):
  print("Yes")
else:
  print("No")

from collections import Counter

s = input()
t = input()

a = Counter(s)
b = Counter(t)

c = list(a.values())
d = list(b.values())

print('Yes') if c == d else print('No')

import collections
a = list(input())
b = list(input())
A = collections.Counter(a)
B = collections.Counter(b)
Alist = list(A.values())
Blist = list(B.values())
Asort = sorted(Alist)
Bsort = sorted(Blist)
if Asort == Bsort:
  print("Yes")
else:
  print("No")

"""
必要十分条件
１）Sの中の同じ文字が、Tの別の文字に対応していない
２）Tの中の同じ文字が、Sの別の文字に対応していない
"""

s = input()
t = input()

dict_st = {}
dict_ts = {}

for x, y in zip(s, t):
    if x not in dict_st:
        dict_st[x] = y
    else:
        if dict_st[x] != y:
            print('No')
            break
    
    if y not in dict_ts:
        dict_ts[y] = x
    else:
        if dict_ts[y] != x:
            print('No')
            break
else:
    print('Yes')


S = input()
T = input()

convert = dict()

# 変換元の重複チェック？
flg = True
for s, t in zip(S, T):
    if s in convert and convert[s] != t:
        flg = False
        break
    convert[s] = t

# 変換先の重複チェック
after = list(convert.values())
if len(after) != len(set(after)):
    flg = False

if flg:
    print('Yes')
else:
    print('No')


s = input()
t = input()

def char_list(s):
    l = [0] * 26
    for x in s:
        i = ord(x) - ord("a")
        l[i] += 1
    l.sort()
    return l

l1 = char_list(s)
l2 = char_list(t)

if l1 == l2:
    print("Yes")
else:
    print("No")


from collections import Counter
s = Counter(input())
t = Counter(input())

ans = "Yes"
for x,y in zip(s.items(), t.items()):
    if x[1] != y[1]:
        ans = "No"
print(ans)

S = input()
T = input()
ans = 'Yes'
dic1,dic2 = {},{}

for i,j in zip(S,T):
    if i in dic1:
        if dic1[i] != j:
            ans = 'No'
    else:
        dic1[i] = j
        
    if j in dic2:
        if dic2[j] != i:
            ans = 'No'
    else:
        dic2[j] = i

#print(dic1)
#print(dic2)
print(ans)

S = input()
T = input()
N = len(S)
# SからTの変換
d1 = {}
# TからSの変換
d2 = {}

for i in range(N):
    if S[i] not in d1:
        d1[S[i]] = T[i]
    else:
        if d1[S[i]] != T[i]:
            print("No")
            return
        else:
            pass

    if T[i] not in d2:
        d2[T[i]] = S[i]
    else:
        if d2[T[i]] != S[i]:
            print("No")
            return
        else:
            pass
print("Yes")


s=list(input())
t=list(input())
cnt1=[[] for _ in range(26)]
cnt2=[[] for _ in range(26)]
for i in range(len(s)):
    num1=ord(s[i])-97
    num2=ord(t[i])-97
    if t[i] not in cnt1[num1]:
        cnt1[num1].append(t[i])
    if s[i] not in cnt2[num2]:
        cnt2[num2].append(s[i])
ans=0
for i in range(26):
    if len(cnt1[i])>1:
        ans=1
        break
    if len(cnt2[i])>1:
        ans=1
        break
if ans==0:
    print("Yes")
else:
    print("No")


import numpy as np
S    = np.array(list(input()))
T    = np.array(list(input()))
N    = len(S)
SSrt = np.sort(S)
TSrt = np.sort(T)
SArg = np.argsort(S)
TArg = np.argsort(T)
SAgT = S[TArg]
TAgS = T[SArg]

SBef = ''
TBef = ''
SFlag = True
for ST in range(0,N):
    SNow = SSrt[ST]
    TNow = TAgS[ST]
    if SBef==SNow:
        if TBef!=TNow:
            SFlag = False
            break
    SBef = SNow
    TBef = TNow
        
SBef = ''
TBef = ''
TFlag = True
for TT in range(0,N):
    SNow = SAgT[TT]
    TNow = TSrt[TT]
    if TBef==TNow:
        if SBef!=SNow:
            TFlag = False
            break
    SBef = SNow
    TBef = TNow
        
if SFlag and TFlag:
    print('Yes')
else:
    print('No')

from collections import defaultdict

s = input()
t = input()

dicts = defaultdict(int)
dictt = defaultdict(int)

cs = []
ct = []

for i in range(len(s)):
    dicts[s[i]] += 1
    dictt[t[i]] += 1
    cs.append(dicts[s[i]])
    ct.append(dictt[t[i]])


if cs == ct:
    print('Yes')
else:
    print('No')

import sys


def IN_I(): return int(sys.stdin.readline().rstrip())
def IN_LI(): return list(map(int, sys.stdin.readline().rstrip().split()))
def IN_S(): return sys.stdin.readline().rstrip()
def IN_LS(): return list(sys.stdin.readline().rstrip().split())


S = IN_S()
T = IN_S()

d1 = dict()
d2 = dict()

len_s = len(S)

for i in range(len_s):
    a = S[i]
    b = T[i]
    if (a in d1 and d1[a] != b) or (b in d2 and d2[b] != a):
        print('No')
        return
    d1[a] = b
    d2[b] = a

print('Yes')


from collections import Counter
s=input()
t=input()
list_S=Counter(s)
list_T=Counter(t)

if sorted(list_S.values()) == sorted(list_T.values()):
    print("Yes")
else:
    print("No")


from collections import defaultdict
s = input()
t = input()
n = len(s)

d = defaultdict(str)
# ダメな場合
# 1. 同じtが違うsに対応
# 2. 同じsが違うtに対応
for i in range(n):
    if d[t[i]] == "":
        d[t[i]] = s[i]
    elif d[t[i]] != s[i]:
        print("No")
        return
d.clear()
for i in range(n):
    if d[s[i]] == "":
        d[s[i]] = t[i]
    elif d[s[i]] != t[i]:
        print("No")
        return

print("Yes")


from collections import Counter
s = input()
t = input()
#文字の順番入れ替えは可能
#文字の個数は増やせない
#結局はaabbbなら2,3になる
#abcdbならa:1,b:2,c:1,d:1
s_dict = Counter(s)
t_dict = Counter(t)
s_val = list(s_dict.values())
t_val = list(t_dict.values())
s_val.sort()
t_val.sort()
if s_val == t_val:
    print('Yes')
else:
    print('No')



import sys
import math
from collections import defaultdict
from collections import deque

sys.setrecursionlimit(1000000)
MOD = 10 ** 9 + 7
input = lambda: sys.stdin.readline().strip()
NI = lambda: int(input())
NMI = lambda: map(int, input().split())
NLI = lambda: list(NMI())
SI = lambda: input()


def main():
    S = SI()
    T = SI()
    D = defaultdict(str)
    for s, t in zip(S, T):
        if D[s] == "":
            D[s] = t
        if D[s] != t:
            print("No")
            return
    if len(set(D.keys())) != len(set(D.values())):
        print("No")
    else:
        print("Yes")


def __starting_point():
    main()
__starting_point()

# -*- coding: utf-8 -*-
"""
Created on Wed Sep 30 03:40:29 2020

@author: liang
"""

A = list()
B = list()
for i in range(26):
    A.append(list())
    B.append(list())
S = input()
T = input()
def solve():
    for i in range(len(S)):
            index = ord(S[i]) - ord("a")
            A[index].append(i)
            
    for a_lis in A:
        flag = False
        if a_lis:
            tmp = T[a_lis[0]]
        for t in a_lis:
            if T[t] != tmp:
                flag = True
        if flag:
            print("No")
            return
        
    for i in range(len(T)):
            index = ord(T[i]) - ord("a")
            B[index].append(i)
   
    for b_lis in B :
        flag = False
        if b_lis:
            tmp = S[b_lis[0]]
        for t in b_lis:
            if S[t] != tmp:
                flag = True
        if flag:
            print("No")
            return
    
    print("Yes")
    #print(B)
    return 

solve()

s = input()
t = input()
s = sorted(map(s.count,set(s)))
t = sorted(map(t.count,set(t)))
print("Yes" if s==t else "No")

S=input()
T=input()

D1={}
D2={}

ans=1
for s,t in zip(S,T):
    x=D1.get(t, '')
    if x=='':
        D1[t]=s
    else:
        if x!=s:
            ans=0
            break
            
    x=D2.get(s, '')
    if x=='':
        D2[s]=t
    else:
        if x!=t:
            ans=0
            break

print('Yes' if ans else 'No')

s = input()
t = input()

s_map = [[] for i in range(26)]
t_map = [[] for i in range(26)]
n = len(s)

for i in range(n):
    si = ord(s[i]) - ord("a")
    ti = ord(t[i]) - ord("a")
    
    s_map[si].append(i)
    t_map[ti].append(i)

s_map = sorted(s_map)
t_map = sorted(t_map)

if s_map == t_map:
    print("Yes")
else:
    print("No")
# print(s_map)
# print(t_map)


s = input()
t = input()

def f(x):
    dic = {}
    for c in x:
        if c in dic:
            dic[c] += 1
        else:
            dic[c] = 1
    return dic

d1 = f(s)
d2 = f(t)
l1 = [i for i in d1.values()]
l2 = [i for i in d2.values()]
l1.sort()
l2.sort()

if l1 == l2:
    print('Yes')
else:
    print('No')

s = list(input())
t = list(input())
n = len(s)

s_par = [i for i in range(n + 1)]
t_par = [i for i in range(n + 1)]

def operation(x, par):
    for i in range(n):
        for j in range(i):
            if x[i] == x[j]:
                par[i] = par[j]
                break
    return par

if operation(s, s_par) == operation(t, t_par):
    print('Yes')
else:
    print('No')

S = input()
T = input()
N = len(S)

chr_from = {}
chr_to = {}

flg = True

for i in range(N):
    if T[i] in chr_to:
        if S[i] not in chr_from:
            chr_to[T[i]] += 1
    else:
        chr_to[T[i]] = 1
    
    if S[i] in chr_from:
        if chr_from[S[i]] != T[i]:
            flg = False
    else:
        chr_from[S[i]] = T[i]

for val in chr_to.values():
    if val > 1:
        flg = False


print(['No', 'Yes'][flg])

from collections import Counter
s=Counter(list(input()))
t=Counter(list(input()))
s1,t1=sorted(list(s.values())),sorted(list(t.values()))
print("Yes" if s1==t1 else "No")

import sys
 
input = sys.stdin.readline
S = input().strip()
T = input().strip()
 
# S -> T
index_s = {}
# T -> S
index_t = {}
for i in range(len(S)):
    if T[i] in index_t:
        if index_t[T[i]] != S[i]:
            print("No")
            return
    else:
        index_t[T[i]] = S[i]

    if S[i] in index_s:
        if index_s[S[i]] != T[i]:
            print("No")
            return
    else:
        index_s[S[i]] = T[i]
 
print("Yes")

s = input()
t = input()
n = len(s)
x = []
y = []

for i in range(n):
    if s[i] not in x:
        x.append(s[i])
    if t[i] not in y:
        y.append(t[i])

for i in range(len(x)):
    s = s.replace(x[i], str(i))
for i in range(len(y)):
    t = t.replace(y[i], str(i))
print('Yes' if s == t else 'No')

from collections import defaultdict

S = input()
T = input()

dictS = defaultdict(int)
dictT = defaultdict(int)
dictS[S[0]] = dictT[T[0]] = 1
n = 2

for i in range(1, len(S)):
    if dictS[S[i]] == dictT[T[i]]:
        if dictS[S[i]] == 0:
            dictS[S[i]] = dictT[T[i]] = n
            n += 1
    else:
        print('No')
        break
else:
    print('Yes')

s = input()
t = input()
d = []
for l in [s, t]:
    ptr = 0
    dct = dict()
    for c in l:
        if c not in list(dct.keys()):
            dct[c] = chr(ord("A")+ptr)
            ptr += 1
    d.append([dct[c] for c in l])

print(("Yes" if "".join(d[0]) == "".join(d[1]) else "No"))


import sys
s = list(input())
t = list(input())
a = [-1 for _ in range(26)]
b = [-1 for _ in range(26)]

for i in range(len(s)):
    num0, num1 = a[ord(s[i])-97], b[ord(t[i])-97]
    if num0 >= 0:
        if chr(num0+97) != t[i]:
            print('No')
            return
    else:
        a[ord(s[i])-97] = ord(t[i])-97
        
    if num1 >= 0:
        if chr(num1+97) != s[i]:
            print('No')
            return
    else:
        b[ord(t[i])-97] = ord(s[i])-97
            
print('Yes')


s = input()
t = input()
x = []
y = []
for i in range(len(s)):
    if s[i] not in x:
        x.append(s[i])
    if t[i] not in y:
        y.append(t[i])
for i in range(len(x)):
    s = s.replace(x[i], str(i))
for i in range(len(y)):
    t = t.replace(y[i], str(i))
if s == t:
    print("Yes")
else:
    print("No")

s=list(input())
t=list(input())
n=len(s)
a=[s.count(chr(97+i)) for i in range(26)]
b=[t.count(chr(97+i)) for i in range(26)]
if all(a[ord(s[i])-97]==b[ord(t[i])-97] for i in range(n)):
    print("Yes")
else:
    print("No")



def solve():
    S=input()
    n=len(S)
    S1=[1]
    k=1
    for i in range(1,n):
        if S[i] not in S[:i]:
            k+=1
            S1.append(k)
        else:
            num=S1[S.find(S[i])]
            S1.append(num)
    return S1

S1=solve()
T1=solve()

if S1==T1:
    print('Yes')
else:
    print('No')

s = input()
t = input()

dict_st = {}
dict_ts = {}

for x, y in zip(s, t):
    if x not in dict_st:
        dict_st[x] = y
    else:
        if dict_st[x] != y:
            print("No")
            break

    if y not in dict_ts:
        dict_ts[y] = x
    else:
        if dict_ts[y] != x:
            print("No")
            break
else:
    print("Yes")


S,T = input(),input()

d = [None]*26
flag = True
for s,t in zip(S,T):
    s = ord(s)-ord('a')
    t = ord(t)-ord('a')
    if d[s] is None:
        d[s] = t
    elif d[s] != t:
        flag = False
        break

if not flag:
    print('No')
elif len(set(v for v in d if v is not None)) != sum(int(v is not None) for v in d):
    print('No')
else:
    print('Yes')

#from statistics import median
#import collections
#aa = collections.Counter(a) # list to list || .most_common(2)で最大の2個とりだせるお a[0][0]
from fractions import gcd
from itertools import combinations,permutations,accumulate, product # (string,3) 3回
#from collections import deque
from collections import deque,defaultdict,Counter
import decimal
import re
#import bisect
#
#    d = m - k[i] - k[j]
#    if kk[bisect.bisect_right(kk,d) - 1] == d:
#
#
#
# pythonで無理なときは、pypyでやると正解するかも！！
#
#
# my_round_int = lambda x:np.round((x*2 + 1)//2)
# 四捨五入g
import sys
sys.setrecursionlimit(10000000)
mod = 10**9 + 7
#mod = 9982443453
def readInts():
  return list(map(int,input().split()))
def I():
  return int(input())
dics = defaultdict(str)
dict = defaultdict(str)
s = input()
t = input()
for i in range(len(s)):
    if dics[s[i]]:
        if dics[s[i]] == t[i]:
            pass
        else:
            print('No')
            return
    else:
        dics[s[i]] = t[i]
    if dict[t[i]]:
        if dict[t[i]] == s[i]:
            pass
        else:
            print('No')
            return
    else:
        dict[t[i]] = s[i]
print('Yes')


S = input()
T = input()
s_let = [0]*26
t_let = [0]*26
ans = "Yes"

for i in range(len(S)):
  s_let[ord(S[i])-ord("a")] += 1
for j in range(len(T)):
  t_let[ord(T[j])-ord("a")] += 1

s_let.sort()
t_let.sort()

for k in range(26):
  if s_let[k] != t_let[k]:
    ans = "No"

print(ans)

s=input()
t=input()
sset=set()
tset=set()
j=1
alp={}
ds=[0]*len(s)
for i in range(len(s)):
  if not s[i] in sset:
    alp[s[i]]=j
    ds[i]=j
    sset.add(s[i])
    j+=1
  else:
    ds[i]=alp[s[i]]
j=1
alp={}
dt=[0]*len(t)
for i in range(len(t)):
  if not t[i] in tset:
    alp[t[i]]=j
    dt[i]=j
    tset.add(t[i])
    j+=1
  else:
    dt[i]=alp[t[i]]
for i in range(len(s)):
  if ds[i]!=dt[i]:
    print('No')
    return
print('Yes')

# import sys
# sys.setrecursionlimit(10 ** 6)
# import bisect
# from collections import deque
# from decorator import stop_watch
# 
# 
# @stop_watch
def solve(S, T):
    N = len(S)
    S_check = [0] * N
    T_check = [0] * N
    for i in range(N):
        if S_check[i] == 0:
            S_check[i] = 1
            for j in range(i + 1, N):
                if S[i] == S[j]:
                    S_check[j] = 1
                    if T[i] != T[j]:
                        print('No')
                        return
        if T_check[i] == 0:
            T_check[i] = 1
            for j in range(i + 1, N):
                if T[i] == T[j]:
                    T_check[j] = 1
                    if S[i] != S[j]:
                        print('No')
                        return
    print('Yes')


def __starting_point():
    S = input()
    T = input()
    solve(S, T)

    # # test
    # from random import randint
    # from func import random_str
    # S = 'abcdefghijklmnopqrstuvwxyz' * (2 * 10 ** 5 // 26 + 1)
    # T = 'abcdefghijklmnopqrstuvwxyz' * (2 * 10 ** 5 // 26 + 1)
    # solve(S, T)

__starting_point()

import sys

input = sys.stdin.readline

S = input()
S = S.replace('\n','')
s_list = list(S)

T = input()
T = T.replace('\n','')
t_list = list(T)

alpha_dict = {}
t_diff_count = [0 for i in range(27)]
s_diff_count = [0 for i in range(27)]

for i,c in enumerate(range(ord('a'),ord('z')+1)):
    alpha_dict[chr(c)] = i 

for i,s in enumerate(s_list):
    #if not s == t_list[i]:
    number = alpha_dict[s_list[i]]
    s_diff_count[number] += 1
    number = alpha_dict[t_list[i]]
    t_diff_count[number] += 1

for i,s in enumerate(s_list):
    number = alpha_dict[s_list[i]]
    s_count = s_diff_count[number] 
    number = alpha_dict[t_list[i]]
    t_count = t_diff_count[number]
    if not s_count == t_count:
        if t_count >= 2:
            print("No")
            return
        if s_count >= 2:
            print("No")
            return
print("Yes")    


from collections import Counter
s = input()
t = input()

s_count = Counter(s)
t_count = Counter(t)
if sorted(s_count.values()) == sorted(t_count.values()): print("Yes")
else: print("No")

S=input()
T=input()

dict_S={}
dict_T={}

for x, y in zip(S, T):
    if x not in dict_S:
        dict_S[x] = y
    else:
        if dict_S[x] != y:
            print("No")
            return

    if y not in dict_T:
        dict_T[y] = x
    else:
        if dict_T[y] != x:
            print("No")
            return


print("Yes")

s=input()
t=input()
n=len(s)
f=0
a=[[] for i in range(26)]
for i in range(n):
    
    if len(a[ord(s[i])-97])==0:
        a[ord(s[i])-97].append(t[i])
    else:
        if a[ord(s[i])-97][0]!=t[i]:
            f=1
x=[a[i][0] for i in range(26) if len(a[i])==1]
if len(x)!=len(set(x)):
    f=1
print(("Yes" if f==0 else "No"))

    


s = input()
t = input()

sc = {}
tc = {}

for i in range(len(s)):
    if s[i] in sc:
        sc[s[i]].append(i)
    else:
        sc[s[i]] = [i]

    if t[i] in tc:
        tc[t[i]].append(i)
    else:
        tc[t[i]] = [i]

sc = list(sc.values())
tc = list(tc.values())

print("Yes" if sc == tc else "No")

s = input()
t = input()
sl = len(s)
ss = ""
used = [False]*26
cnt = 0
for i in range(sl):
    if used[(ord(s[i])-97)%26]:
        ss += str(used[(ord(s[i])-97)%26])
    else:
        cnt += 1
        ss += str(cnt)
        used[(ord(s[i])-97)%26] = cnt

used = [False]*26
tt = ""
cnt = 0
for i in range(sl):
    if used[(ord(t[i])-97)%26]:
        tt += str(used[(ord(t[i])-97)%26])
    else:
        cnt += 1
        tt += str(cnt)
        used[(ord(t[i])-97)%26] = cnt

if ss==tt:
    print("Yes")
else:
    print("No")

import sys
import math
from collections import defaultdict, deque, Counter
from copy import deepcopy
from bisect import bisect, bisect_right, bisect_left
from heapq import heapify, heappop, heappush
    
input = sys.stdin.readline
def RD(): return input().rstrip()
def F(): return float(input().rstrip())
def I(): return int(input().rstrip())
def MI(): return map(int, input().split())
def MF(): return map(float,input().split())
def LI(): return list(map(int, input().split()))
def TI(): return tuple(map(int, input().split()))
def LF(): return list(map(float,input().split()))
def Init(H, W, num): return [[num for i in range(W)] for j in range(H)]
    
    
def main():
    S = input().rstrip()
    T = input().rstrip()
    L = [[S[i],T[i]] for i in range(len(S))]
    L.sort(key = lambda x: x[0])
    D = defaultdict(int)
    D2 = defaultdict(int)
    for a, b in L:
        if (D[a] == 0 or D[a] == b) and (D2[b] == 0 or D2[b] == a):
            D[a]=b
            D2[b]=a
        else:
            print("No")
            return
    print("Yes")
    
    
def __starting_point():
    main()
__starting_point()

#!/usr/bin/env python3
from collections import Counter
x = lambda : sorted(Counter(input()).values())
print(('YNeos'[x()!=x()::2]))


s = input()
t = input()
memo = {}
ans = 'Yes'
for i in range(len(s)):
    if s[i] in memo:
        if t[i] != memo[s[i]]:
            ans = 'No'
            break
    else:
        memo[s[i]] = t[i]
a = list(memo.values())
b = list(set(a))
if len(b) != len(a):
    ans = 'No'
print(ans)

from collections import Counter
S = list(input())
T = list(input())
change = [-1]*27
ans = "Yes"
for i in range(len(S)):
    s = ord(S[i])-97
    if S[i] == T[i]:
        change[s] = s
    elif change[s] == -1:
        change[s] = ord(T[i])-97
    else:
        t = ord(T[i])-97
        if change[s] != t:
            ans = "No"
            break
change=Counter(change)
del change[-1]
for i in change.values():
    if i==1:
        continue
    else:
        ans="No"
print(ans)

s=list(input())
t=list(input())
n=len(s)
def get_count_list(s):
    alphabets="abcdefghijklmnopqrstuvwxyz"
    ans={}
    for alphabet in alphabets:
        ans[alphabet]=[]
    for i in range(n):
        ans[s[i]].append(i)
    return ans


def get_index2alpha(s):
    ans={}
    for i in range(n):
        ans[i]=s[i]
    return ans

s_count=get_count_list(s)
t_count=get_count_list(t)
s_index=get_index2alpha(s)
t_index=get_index2alpha(t)

ans=0

s_set=set(s)


for i in range(n):
    s_alpha=s_index[i]
    t_alpha = t_index[i]
    if s_alpha in s_set:
        s_set.remove(s_alpha)
        if not s_count[s_alpha]==t_count[t_alpha]:
            ans+=1

if ans==0:
    print("Yes")
else:
    print("No")

s = input()
t = input()

sc = [0] * 26
tc = [0] * 26

for i in range(len(s)):
    sc[ord(s[i]) - ord('a')] += 1
    tc[ord(t[i]) - ord('a')] += 1

sc.sort()
tc.sort()

if tuple(sc) == tuple(tc):
    print('Yes')
else:
    print('No')


import sys
# import math
# import bisect
# import numpy as np
# from decimal import Decimal
# from numba import njit, i8, u1, b1 #JIT compiler
# from itertools import combinations, product
from collections import Counter, deque, defaultdict

# sys.setrecursionlimit(10 ** 6)
MOD = 10 ** 9 + 7
INF = 10 ** 9
PI = 3.14159265358979323846

def read_str():      return sys.stdin.readline().strip()
def read_int():      return int(sys.stdin.readline().strip())
def read_ints():     return map(int, sys.stdin.readline().strip().split())
def read_ints2(x):   return map(lambda num: int(num) - x, sys.stdin.readline().strip().split())
def read_str_list(): return list(sys.stdin.readline().strip().split())
def read_int_list(): return list(map(int, sys.stdin.readline().strip().split()))
def GCD(a: int, b: int) -> int: return b if a%b==0 else GCD(b, a%b)
def LCM(a: int, b: int) -> int: return (a * b) // GCD(a, b)

def Main():
    s = read_str()
    t = read_str()

    s_lis = sorted(Counter(s).values())
    t_lis = sorted(Counter(t).values())
    
    if s_lis == t_lis:
        print('Yes')
    else:
        print('No')

def __starting_point():
    Main()
__starting_point()

S = input()
T = input()

trans_dict = {}

for i in range(len(S)):
    s = S[i]
    t = T[i]

    if s in trans_dict:
        if not trans_dict[s] == t:
            print('No')
            return
    else:
        trans_dict[s] = t

if len(list(trans_dict.values())) == len(set(trans_dict.values())):
    print('Yes')
else:
    print('No')


#!/usr/bin/env python
# coding: utf-8

# In[16]:


S = input()
T = input()


# In[20]:


mydict = {}
for i in range(len(S)):
    if S[i] in mydict:
        if T[i] != mydict[S[i]]:
            ans = "No"
            break
    else:
        mydict[S[i]] = T[i]
else:
    a = list(mydict.values())
    b = list(set(a))
    if len(b) != len(a):
        ans = "No"
    else:
        ans = "Yes"
print(ans)


# In[ ]: