Problem:
 Score : 300 points    Problem Statement 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 1 azzel
apple      Sample Output 1 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 .        Sample Input 2 chokudai
redcoder      Sample Output 2 No  No sequences of operation can change chokudai to redcoder .       Sample Input 3 abcdefghijklmnopqrstuvwxyz
ibyhqfrekavclxjstdwgpzmonu      Sample Output 3 Yes

Solution (Python):
S = input()
T = input()
R = [0 for _ in range(26)]
Rrev = [0 for _ in range(26)]
AB = ["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"]

Able = True
for i in range(len(S)):
    if R[AB.index(S[i])] == 0:
        R[AB.index(S[i])] = T[i]
    elif R[AB.index(S[i])] != T[i]:
        Able = False
        break
    if Rrev[AB.index(T[i])] == 0:
        Rrev[AB.index(T[i])] = S[i]
    elif Rrev[AB.index(T[i])] != S[i]:
        Able = False
        break

print("Yes" if Able else "No")

Solution (Python):
s, t = input(), input()

print("Yes" if [t.find(t_i) for t_i in t] == [s.find(s_i) for s_i in s] else "No")

Solution (Python):
S = input()
T = input()

X = {}
Y = {}

for i in range(len(S)):
  if not S[i] in X:
    X[S[i]] = T[i]
  elif X[S[i]] == T[i]:
    pass
  else:
    print("No")
    exit(0)

  if not T[i] in Y:
    Y[T[i]] = S[i]
  elif Y[T[i]] == S[i]:
    pass
  else:
    print("No")
    exit(0)

print("Yes")

Solution (Python):
s = input()
t = input()

start = [-1 for i in range(26)]
goal = [-1 for i in range(26)]

for i in range(len(s)):
    a = ord(s[i]) - ord('a')
    b = ord(t[i]) - ord('a')
    
    if start[a] != -1 or goal[b] != -1:
        if start[a] != b or goal[b] != a:
            print("No")
            exit()
    else:
        start[a] = b
        goal[b] = a

print("Yes")

Solution (Python):
S = input()
T = input()
for i in range(len(S)):
    if S.find(S[i]) != T.find(T[i]):
        print('No')
        exit()
print('Yes')

Solution (Python):
S = input()
T = input()
sid = {}
tid = {}
ss = []
tt = []
sn = 0
tn = 0
for i in range(len(S)):
    if not S[i] in sid:
        sid[S[i]] = sn
        sn += 1
    ss += [sid[S[i]]]
    if not T[i] in tid:
        tid[T[i]] = tn
        tn += 1
    tt += [tid[T[i]]]
if ss == tt:
    print('Yes')
else:
    print('No')

Solution (Python):
S = input()
T = input()
d = {}
for s,t in zip(S,T):
    if s in d:
        if d[s] != t:
            print('No')
            exit()
    else:
        d[s] = t

if len(d) != len(set(d.values())):
    print('No')
else:
    print('Yes')

Solution (Python):
def main():
    s, t = input(), input()

    s_dic, t_dic = {}, {}
    for i, j in zip(s, t):
        if i in s_dic and s_dic[i] != j:
            print("No")
            exit()

        if j in t_dic and t_dic[j] != i:
            print("No")
            exit()

        s_dic[i], t_dic[j] = j, i

    print("Yes")


if __name__ == '__main__':
    main()

Solution (Python):
S = input()
T = input()
U = "abcdefghijklmnopqrstuvwxyz"
s =[0 for i in range(26)]
t =[0 for i in range(26)]
for k in range(26):
    s[k] += S.count(U[k])
    t[k] += T.count(U[k])
print("Yes" if sorted(s)==sorted(t) else "No")

Solution (Python):
import sys
from collections import Counter
one=list(input())

two=list(input())
z={}
result=[]
for num,i in enumerate(one):
    if i not in z:
        z[i]=[num]
    else:
        z[i].append(num)
p={}
for num,i in enumerate(two):
    if i not in p:
        p[i]=[num]
    else:
        p[i].append(num)




w=[]
for k,v in z.items():
    if len(v)>1:
        w.append(v)
o=[]
for k,v in p.items():
    if len(v)>1:
        o.append(v)


"""
for i in w:
    if i not in o:
        print("No")
        sys.exit()
for i in o:
    if i not in w:
        print("No")
        sys.exit()
print("Yes")"""
"""


for k,v in z.items():
    if len(v)>1:
        temp=0
        for k1, v1 in p.items():
            if p[k1]==z[k]:
                temp=1
"""



w.sort()
o.sort()
print("Yes") if w==o else print("No")

Solution (Python):
s = input()
t = input()
enco = {}
enco2 = {}
for i in range(len(s)):
  if t[i] not in enco:
    enco[t[i]] = s[i]
  else:
    if enco[t[i]] != s[i]:
      print("No")
      exit()
  if s[i] not in enco2:
    enco2[s[i]] = t[i]
  else:
    if enco2[s[i]] != t[i]:
      print("No")
      exit()
print("Yes")

Solution (Python):
import sys
from collections import Counter
one=list(input())

two=list(input())
z={}
result=[]
for num,i in enumerate(one):
    if i not in z:
        z[i]=[num]
    else:
        z[i].append(num)
p={}
for num,i in enumerate(two):
    if i not in p:
        p[i]=[num]
    else:
        p[i].append(num)




w=[]
for k,v in z.items():
    if len(v)>1:
        w.append(v)
o=[]
for k,v in p.items():
    if len(v)>1:
        o.append(v)


for i in w:
    if i not in o:
        print("No")
        sys.exit()
for i in o:
    if i not in w:
        print("No")
        sys.exit()
print("Yes")

Solution (Python):
from collections import Counter

s = input()
t = input()

ds = Counter(list(s))
ts = Counter(list(t))

print('Yes') if(sorted(ds.values()) == sorted(ts.values())) else print('No')

Solution (Python):
S=input()
T=input()
X=0
for i in range(len(S)):
    s=S[i]
    if ord(s)>96:
        X+=1
        S=S.replace(s,chr(X+47))
Y=0
for i in range(len(T)):
    t=T[i]
    if ord(t)>96:
        Y+=1
        T=T.replace(t,chr(Y+47))
print('Yes'if S==T else'No')

Solution (Python):
a=input()
b=input()

while (1):
    if a=='':
        break
    a=a.replace(a[0],'')
    b=b.replace(b[0],'')    

    if len(a)!=len(b):
        print('No')
        exit()

print('Yes')

Solution (Python):


S = input()
T = input()


start = {}
goal = {}

for i in range(len(S)):
    s = S[i]
    t = T[i]
    
    if s in start or t in goal:
        
        if start.get(s) != t or goal.get(t) != s:
            print('No')
            exit()
    
    else:
        start[s] = t
        goal[t] = s

print('Yes')

Solution (Python):


S = input()
T = input()


start = {}
goal = {}

for i in range(len(S)):
    s = S[i]
    t = T[i]
    
    if s in start:
        
        if start[s] != t:
            print('No')
            exit()
    
    else:
        start[s] = t
    
    if t in goal:
        if goal[t] != s:
            print('No')
            exit()
    else:
        goal[t] = s

print('Yes')

Solution (Python):
def main():
    data0 = input()
    data1 = input()

    flag = True
    data_tmp = data0
    count = 0
    len_data = len(data0)
    while True:
        if data0 == "":
            break

        data0 = data0.replace(data0[0], "")
        data1 = data1.replace(data1[0], "")

        if len(data0) != len(data1):
            print('No')
            exit()

    print('Yes')

if __name__ == "__main__":
    main()

Solution (Python):
S = input()
T = input()

def normalize(s):
    pos = {}
    for i, c in enumerate(s):
        if not c in pos:
            pos[c] = i
        yield pos[c]

if all(x == y for x, y in zip(normalize(S), normalize(T))):
    print("Yes")
else:
    print("No")

Solution (Python):
S = input()
T = input()
ans ='Yes'
d = {}
d2 = {}
for s, t in zip(S, T):

    if d.get(s) is not None:
        if d[s] != t:
            ans = 'No'
            break
    else:
        d[s] = t

    if d2.get(t) is not None:
        if d2[t] != s:
            ans = 'No'
            break
    else:
        d2[t] = s

print(ans)

Solution (Python):



sS = input().rstrip()
sT = input().rstrip()

aS = [0] * 26
aT = [0] * 26
sABC = "abcdefghijklmnopqrstuvwxyz"
for i in range(26):
    aS[i]=sS.count(sABC[i])
    aT[i]=sT.count(sABC[i])
aS.sort()
aT.sort()
if aS == aT:
    print ("Yes")
else:
    print ("No")

Solution (Python):


S = input()
T = input()


start = [-1] * 26
goal = [-1] * 26

for i in range(len(S)):
    
    a = ord(S[i]) - ord('a')
    b = ord(T[i]) - ord('a')
    
    if start[a] != -1 or goal[b] != -1:
        
        if start[a] != b or goal[b] != a:
            print('No')
            exit()
    
    else:
        start[a] = b
        goal[b] = a

print('Yes')

Solution (Python):
sS = input().rstrip()
sT = input().rstrip()

aS = [0] * 26
aT = [0] * 26
sABC = "abcdefghijklmnopqrstuvwxyz"
for i in range(26):
    aS[i]=sS.count(sABC[i])
    aT[i]=sT.count(sABC[i])
aS.sort()
aT.sort()
if aS == aT:
    print ("Yes")
else:
    print ("No")

Solution (Python):
S = input()
T = input()
ST = {}
TS = {}
for i in range(len(S)):
    s = S[i]
    t = T[i]
    if s in ST:
        if ST[s] != t:
            print("No")
            break
    else:
        ST[s] = t
    if t in TS:
        if TS[t] != s:
            print("No")
            break
    else:
        TS[t] = s
else:
    print("Yes")

Solution (Python):
def get_alphabet_num(s):
    return ord(s) - ord('a')


R = [-1] * 26
R_ = [-1] * 26
for s, t in zip(input(), input()):
    si = get_alphabet_num(s)
    ti = get_alphabet_num(t)
    if R[si] >= 0:
        
        if R[si] == ti:
            pass
        else:
            print('No')
            exit()
    if R_[ti] >= 0:
        
        if R_[ti] == si:
            pass
        else:
            print('No')
            exit()
    
    R[si] = ti
    
    R_[ti] = si
print('Yes')

Solution (Python):

from sys import stdin
import re

s_in = lambda: stdin.readline()[:-1] 
d_in = lambda: int(stdin.readline()) 
ds_in = lambda: list(map(int, stdin.readline().split())) 

S = s_in()
T = s_in()
N = len(S)

rec = []
idxes = [i for i in range(26)]

def alpnum(s):
    return ord(s) - ord('a')

for i in range(N):
    si = alpnum(S[i])
    ti = alpnum(T[i])
    if (idxes[si] != ti):
        if (idxes[si] in rec) or (ti in rec):
            print('No')
            exit()
        idx = idxes.index(ti)
        idxes[si], idxes[idx] = idxes[idx], idxes[si]
    rec.append(ti)
print('Yes')

Solution (Python):
from collections import defaultdict
start = defaultdict(lambda: -1)
goal = defaultdict(lambda: -1)
for s, t in zip(input(), input()):
    if start[s] != -1 or goal[t] != -1:
        if start[s] != t or goal[t] != s:
            print('No')
            exit()
    start[s], goal[t] = t, s
print('Yes')

Solution (Python):
S = raw_input()
T = raw_input()

s_c_list = []
t_c_list = []

new_S = ""
new_T = ""

for i in range(len(S)):
    if not S[i] in s_c_list:
        new_S+=str(len(s_c_list))
        s_c_list.append(S[i])
    else:
        new_S+=str(s_c_list.index(S[i]))
    if not T[i] in t_c_list:
        new_T+=str(len(t_c_list))
        t_c_list.append(T[i])
    else:
        new_T+=str(t_c_list.index(T[i]))

if new_S==new_T:
    print "Yes"
else:
    print "No"

Solution (Python):
import sys

S = input()
T = input()

r_dic = {}
s_dic = {}
for i in range(len(S)):
    s = S[i]
    t = T[i]
    
    

    if(t in r_dic and r_dic[t] != s):
        print("No")
        sys.exit()
    else:
        r_dic[t] = s

    if(s in s_dic and s_dic[s] != t):
        print("No")
        sys.exit()
    else:
        s_dic[s] = t

print("Yes")

Solution (Python):

S = input()
T = input()
map_table = {}
imap_table = {}
fail = False
for i, c in enumerate(S):
    if S[i] not in map_table and T[i] not in imap_table:
        map_table[S[i]] = T[i]
        imap_table[T[i]] = S[i]
    if S[i] not in map_table or map_table[S[i]] != T[i]:
        fail = True
        break
    if T[i] not in imap_table or imap_table[T[i]] != S[i]:
        fail = True
        break
print('No' if fail else 'Yes')

Solution (Python):
import collections

S = input()
T = input()

S_count = [v for v in collections.Counter(S).values()]
S_count.sort()
T_count = [v for v in collections.Counter(T).values()]
T_count.sort()

if S_count == T_count:
    print('Yes')
else:
    print('No')

Solution (Python):
from collections import Counter

S = Counter(list(input()))
T = Counter(list(input()))
s,t = list(S.values()), list(T.values())
print(["No", "Yes"][sorted(s) == sorted(t)])

Solution (Python):
import sys

s = input()
t = input()




n = len(s)

dic = {}
dic2 = {}


for i in range(n):
    if s[i] in dic:
        if dic[s[i]] != t[i]:
            print("No")
            sys.exit()
            
    else:
        dic[s[i]] = t[i]
            
            
    if t[i] in dic2:
        if dic2[t[i]] != s[i]:
            print("No")
            sys.exit()
            
    else:
        dic2[t[i]] = s[i]
        
print("Yes")

Solution (Python):
def run(s, t):
    sc = {}
    tc = {}
    for i in 'abcdefghijklmnopqrstuvwxyz':
        sc[i] = 0
        tc[i] = 0
    counter = 1
    for ss in s:
        if sc[ss] == 0:
            sc[ss] = counter
            counter += 1
    counter = 1
    for tt in t:
        if tc[tt] == 0:
            tc[tt] = counter
            counter += 1
    slist = [sc[ss] for ss in s]
    tlist = [tc[tt] for tt in t]
    if slist == tlist:
        return 'Yes'
    else:
        return 'No'
    '''
    ss = sorted(list(collections.Counter(s).values()))
    tt = sorted(list(collections.Counter(t).values()))
    if ss == tt:
        return 'Yes'
    else:
        return 'No'
    '''


def main():
    s = input()
    t = input()
    print(run(s, t))


if __name__ == '__main__':
    main()

Solution (Python):
from collections import Counter

S = Counter(list(input()))
T = Counter(list(input()))
s,t = list(S.values()),list(T.values())
print(["No", "Yes"][Counter(s) == Counter(t)])

Solution (Python):
S = input()
T = input()
A = [-1]*26
B = [-1]*26
L = len(S)
ans = 'Yes'
for i in range(L):
    ords = ord(S[i])-97
    ordt = ord(T[i])-97
    if A[ords] == -1 and B[ordt] == -1:
        A[ords] = ordt
        B[ordt] = ords
    elif A[ords] == ordt and B[ordt] == ords:
        continue
    else:
        ans = 'No'
print(ans)

Solution (Python):
S = input()
T = input()

d_s2t = dict()
d_t2s = dict()

flg = True
for s, t in zip(S, T):
    if d_s2t.get(s, t) == t:
        d_s2t[s] = t
    else:
        flg = False
        break

    if d_t2s.get(t, s) == s:
        d_t2s[t] = s
    else:
        flg = False
        break

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

Solution (Python):
from collections import Counter as C

def cnt(x):
    return sorted(C(x).values())

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

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

Solution (Python):
ss = input().strip()
ts = input().strip()

mapping = {}
for s, t in zip(ss, ts):
  if mapping.get(s, t) != t:
    print("No")
    quit(0)
  mapping[s] = t
if len(mapping.values()) == len(set(mapping.values())):
  print("Yes")
else:
  print("No")

Solution (Python):
import sys
import collections

def main(S, T):
    print(S, file=sys.stderr)
    print(T, file=sys.stderr)

    m = dict()
    for s, t in zip(S, T):
        if s in m and m[s] != t:
            return "No"
        m[s] = t
    print("  ".join(m), file=sys.stderr)
    print("  ".join(m.values()), file=sys.stderr)
    c = set()
    for t in m.values():
        if t in c:
            return "No"
        c.add(t)
    return "Yes" 

assert main("chokudai", "redcoder") == "No"
assert main("azzel", "apple") == "Yes"
assert main("abcdefghijklmnopqrstuvwxyz", "ibyhqfrekavclxjstdwgpzmonu") == "Yes"
S = input()
T = input()
print(main(S, T))

Solution (Python):
import collections


def run(s, t):
    ss = sorted(list(collections.Counter(s).values()))
    tt = sorted(list(collections.Counter(t).values()))
    if ss == tt:
        return 'Yes'
    else:
        return 'No'


def main():
    s = input()
    t = input()
    print(run(s, t))


if __name__ == '__main__':
    main()

Solution (Python):
s=input();t=input()
u=[];c=0
for i in range(len(s)):
  v=[s[i],t[i]]
  if v not in u:
    u.append(v)
for k in range(len(u)):
  for m in range(len(u)):
    if u[k][0]==u[m][0]:
      if u[k][1]!=u[m][1]:c+=1
for p in range(len(u)):
  for q in range(len(u)):
    if u[p][1]==u[q][1]:
      if u[p][0]!=u[q][0]:c+=1
if c==0:print('Yes')
else:print('No')

Solution (Python):
from collections import defaultdict, Counter

S = input()
T = input()

d_s = defaultdict(int)
d_t = defaultdict(int)

no_flag = False
for s, t in zip(list(S), list(T)):
    d_s[s] += 1
    d_t[t] += 1

if sorted(d_s.values()) == sorted(d_t.values()):
    print("Yes")
else:
    print("No")

Solution (Python):
a=list(input())
b=list(input())
from collections import Counter
def f(s):
    return sorted(Counter(s).values())
if f(a)==f(b):
    print("Yes")
else:
    print("No")

Solution (Python):
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
for snum, tnum in zip(sorted(sc), sorted(tc)):
    if snum != tnum:
        print("No")
        exit()
print("Yes")

Solution (Python):


s = input()
t = input()


ok=1
sset=[[] for i in range(26)]
for i in range(len(s)):
    n=ord(s[i])-ord("a")
    sset[n].append(i)

tset=[[] for i in range(26)]
for i in range(len(t)):
    n=ord(t[i])-ord("a")
    tset[n].append(i)

for i in sset:
    if i not in tset:
        ok=0


if ok==1:
    print("Yes")
else:
    print("No")

Solution (Python):
from collections import Counter as C
print('YNeos'[C(C(input()).values())!=C(C(input()).values())::2])

Solution (Python):
S = input()
T = input()

n = len(S)
c1s = {}
c2s = {}
ans = True
for i in range(n):
    if not ans:
        break

    if S[i] in c1s:
        if c1s[S[i]] != T[i]:
            ans = False
            break
    else:
        c1s[S[i]] = T[i]
    if T[i] in c2s:
        if c2s[T[i]] != S[i]:
            ans = False
            break
    else:
        c2s[T[i]] = S[i]


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

Solution (Python):
from collections import Counter
s = input()
t = input()
for i in range(len(s)-1):
    if s[i] == s[i+1]:
        if t[i] != t[i+1]:
            print("No")
            exit()
s_count = Counter(list(s)).most_common()
t_count = Counter(list(t)).most_common()
for i in range(len(s_count)):
    if s_count[i][1] != t_count[i][1]:
        print("No")
        exit()
print("Yes")

Solution (Python):
import sys
s = input()
t = input()

if s==t:
    print("Yes")
    sys.exit()

alpha = [chr(i) for i in range(97, 97+26)]
checkalpha = []
checks = [0 for i in range(26)]
checkt = [0 for i in range(26)]
for i,a in enumerate(alpha):
    checks[i] = len([i for i, x in enumerate(s) if x == a])
    checkt[i] = len([i for i, x in enumerate(t) if x == a])
checks.sort()
checkt.sort()
if checks == checkt:
    print("Yes")
else:
    print("No")

Solution (Python):
def main():
    data0 = input()
    data1 = input()

    flag = True
    data_tmp = data0
    count = 0
    len_data = len(data0)
    while True:
        if data0 == "":
            break

        data0 = data0.replace(data0[0], "")
        data1 = data1.replace(data1[0], "")

        if len(data0) != len(data1):
            print('No')
            exit()

    print('Yes')

if __name__ == "__main__":
    main()

Solution (Python):
import collections
s = input()
t = input()

S = sorted(list(collections.Counter(s).values()))
T = sorted(list(collections.Counter(t).values()))

if S == T:
    print('Yes')
else:
    print('No')

Solution (Python):
s=input()
t=input()
u=[]
c=0
for i in range(len(s)):
  v=[s[i],t[i]]
  if v not in u:
    u.append(v)
u.sort()
for k in range(len(u)):
  for m in range(len(u)):
    if u[k][0]==u[m][0]:
      if u[k][1]!=u[m][1]:c+=1
for p in range(len(u)):
  for q in range(len(u)):
    if u[p][1]==u[q][1]:
      if u[p][0]!=u[q][0]:c+=1
if c==0:print('Yes')
else:print('No')

Solution (Python):
a = input()
b = input()
list1 = [["a", 0 ],["b", 0 ],["c", 0 ],["d", 0 ],["e", 0 ],["f", 0 ],["g", 0 ],["h", 0 ],["i", 0 ],["j", 0 ],
["k", 0 ],["l", 0 ],["m", 0 ],["n", 0 ],["o", 0 ],["p", 0 ],["q", 0 ],["r", 0 ],["s", 0 ],["t", 0 ],
["u", 0 ],["v", 0 ],["w", 0 ],["x", 0 ],["y", 0 ],["z", 0 ]]
list2 = [["a", 0 ],["b", 0 ],["c", 0 ],["d", 0 ],["e", 0 ],["f", 0 ],["g", 0 ],["h", 0 ],["i", 0 ],["j", 0 ],
["k", 0 ],["l", 0 ],["m", 0 ],["n", 0 ],["o", 0 ],["p", 0 ],["q", 0 ],["r", 0 ],["s", 0 ],["t", 0 ],
["u", 0 ],["v", 0 ],["w", 0 ],["x", 0 ],["y", 0 ],["z", 0 ]]
for i in range(len(a)):
    for j in range(26):
        if a[i] == list1[j][0]:
            list1[j][1] += 1
            break
for i in range(len(b)):
    for j in range(26):
        if b[i] == list2[j][0]:
            list2[j][1] += 1
            break
list3 = [list1[i][1] for i in range(26)]
list3.sort()
list4 = [list2[i][1] for i in range(26)]
list4.sort()
flag = True
for i in range(26):
    if int(list3[i]) != int(list4[i]):
        flag = False
if flag:print("Yes")
else:print("No")

Solution (Python):
import sys
s = input()
t = input()

dic = {}
dic2 = {}























for i in range(len(s)):
    if s[i] in dic:
        if dic[s[i]] != t[i]:
            print("No")
            sys.exit()
    else:
        dic[s[i]] = t[i]

    if t[i] in dic2:
        if dic2[t[i]] != s[i]:
            print("No")
            sys.exit()
    else:
        dic2[t[i]] = s[i]

print("Yes")

Solution (Python):
import sys
import socket

hostname = socket.gethostname()

if hostname == 'F551C':
    sys.stdin = open('c1.in')


def read_int_list():
    return list(map(int, input().split()))


def read_str_list():
    return input().split()


def read_int():
    return int(input())


def read_str():
    return input()


def main():
    S = read_str()
    T = read_str()
    n = len(S)
    res = 'Yes'
    A = [0] * n
    B = [0] * n
    vu = {}
    for i in range(n):
        if S[i] not in vu:
            vu[S[i]] = i
        A[i] = vu[S[i]]

    vu = {}
    for i in range(n):
        if T[i] not in vu:
            vu[T[i]] = i
        B[i] = vu[T[i]]

    if A != B:
        res = 'No'

    
    
    
    
    
    
    print(res)


main()

Solution (Python):
S = input()
T = input()
for i in range(len(S)):
    if S.find(S[i]) != T.find(T[i]):
        print('No')
        exit()
print('Yes')

Solution (Python):
S = raw_input()
T = raw_input()

CS = {}
for s in S:
	if s not in CS:
		CS[s] = 1
	else:
		CS[s] += 1
TS = {}
for t in T:
	if t not in TS:
		TS[t] = 1
	else:
		TS[t] += 1

if False in [CS[S[i]] == TS[T[i]] for i in range(len(T))]:
	print 'No'
else:
	print 'Yes'

Solution (Python):


st1 = input()
st2 = input()
key1 = list(st1)
key2 = list(st2)

def az_count(s):
	ss = []
	ss.append(s.count('a'))
	ss.append(s.count('b'))
	ss.append(s.count('c'))
	ss.append(s.count('d'))
	ss.append(s.count('e'))
	ss.append(s.count('f'))
	ss.append(s.count('g'))
	ss.append(s.count('h'))
	ss.append(s.count('i'))
	ss.append(s.count('j'))
	ss.append(s.count('k'))
	ss.append(s.count('l'))
	ss.append(s.count('n'))
	ss.append(s.count('m'))
	ss.append(s.count('o'))
	ss.append(s.count('p'))
	ss.append(s.count('q'))
	ss.append(s.count('r'))
	ss.append(s.count('s'))
	ss.append(s.count('t'))
	ss.append(s.count('u'))
	ss.append(s.count('v'))
	ss.append(s.count('w'))
	ss.append(s.count('x'))
	ss.append(s.count('y'))
	ss.append(s.count('z'))
	return ss

t = az_count(key1)
t1 = az_count(key2)

t.sort()
t1.sort()
if t == t1:
	print("Yes")
else:
	print("No")

Solution (Python):
sS = input().rstrip()
sT = input().rstrip()




def fConv2B(sA):
    iL = len(sA)
    dA = {}
    for s in "abcdefghijklmnopqrstuvwxyz":
        dA[s] = 0
    iCounter = 1
    for i in range(iL):
        s = sA[i]
        if s in dA:
            if dA[sA[i]] == 0:
                dA[sA[i]] = iCounter
                iCounter += 1
        if  iCounter  == 27 :
            break

    aR = [0]*iL
    for i in range(iL):
        aR[i] = dA[sA[i]]

    return aR



if fConv2B(sS) == fConv2B(sT) :
    print("Yes")
else:
    print("No")

Solution (Python):
s = list(input())
t = list(input())
ls = [[] for i in range(0,26)]
lt = [[] for i in range(0,26)]
alfa = "abcdefghijklmnopqrstuvwxyz"
for i in range(0,len(s)):
    ls[alfa.index(s[i])].append(i)
    lt[alfa.index(t[i])].append(i)
ans = "Yes"
for i in range(0,26):
    if len(ls[i]) == 0:
        continue
    ok = "false"
    for j in range(0,26):
        if len(lt[j]) == 0:
            continue
        if ls[i] == lt[j]:
            ok = "true"
            lt[j] = []
    if ok == "true":
        continue
    else:
        ans = "No"
print(ans)

Solution (Python):
def translate(x,y):
    if x == y[0]:
      return y[1]
    if x == y[1]:
      return y[0]
    return x

s1 = list(input())
s2 = list(input())
list = s1

count = 0
for i in range(len(list)):
    if s1[i] != s2[i]:
      x = s1[i]
      y = s2[i]
      for j in range(len(s1)):
        if s1[j] == x:
          s1[j]=y
        elif s1[j] == y:
          s1[j]=x
      
      
      
      
      count = count+1
    if count > 27:
      break

if s1==s2:
  print ("Yes")
else:
  print ("No")

Solution (Python):
import sys
import socket

hostname = socket.gethostname()

if hostname == 'F551C':
    sys.stdin = open('c1.in')


def read_int_list():
    return list(map(int, input().split()))


def read_str_list():
    return input().split()


def read_int():
    return int(input())


def read_str():
    return input()


def main():
    S = read_str()
    T = read_str()
    n = len(S)
    res = 'Yes'
    A = [0] * n
    B = [0] * n
    vu = {}
    for i in range(n):
        if S[i] in vu:
            A[i] = vu[S[i]]
        else:
            vu[S[i]] = i
            A[i] = vu[S[i]]

    vu = {}
    for i in range(n):
        if T[i] in vu:
            B[i] = vu[T[i]]
        else:
            vu[T[i]] = i
            B[i] = vu[T[i]]

    if A != B:
        res = 'No'

    
    
    
    
    
    
    print(res)


main()

Solution (Python):
s = input()
t = input()
sls = list(s)
tls = list(t)

n = len(s)

for i in range(n) :

   snow = sls[i]
   tnow = tls[i]

   if snow == tnow :
      pass

   else:
      if tnow in sls[0:i]  :
         print('No')
         break

      else :
         for j in range(n) :
            if sls[j] == snow :
               sls[j] = tnow
            elif sls[j] == tnow :
               sls[j] = snow

else :
   if sls == tls :
      print('Yes')
   else :
      print('No')

Solution (Python):
import sys
S  = input()
T  = input()

for ch in list("abcdefghijklmnopqrstuvwxyx"):
    tmp_s, tmp_t = "", ""
    for s, t in zip(S, T):
        if s == ch or t == ch:
            if tmp_s == "" and tmp_t == "":
                tmp_s, tmp_t = s, t
        
        if s == tmp_s: 
            if t != tmp_t:  
                print("No")
                sys.exit()
        if t == tmp_t: 
            if s != tmp_s:  
                print("No")
                sys.exit()
print("Yes")

Solution (Python):
s = input()
t = input()
l = [""]*26
m = list("abcdefghijklmnopqrstuvwxyz")

ans = ("Yes")
for i in range(len(s)):
    idx = m.index(s[i])
    if l[idx] == "":
        l[idx] = t[i]
    else:
        if l[idx] != t[i]:
            ans = "No"
            

        
n = []
for i in l:
    if i != "":
        if i in n:
            ans = "No"
        else:
            n.append(i)
        
        
print(ans)

Solution (Python):
s=list(input())
t=list(input())

checkDict={}
checkDict2={}
flg="Yes"

for i in range(len(s)):

  if(not(s[i] in checkDict.keys())):
    checkDict[s[i]]=t[i]
  else:
    if(checkDict[s[i]]!=t[i]):
      flg="No"

  if(not(t[i] in checkDict2.keys())):
    checkDict2[t[i]]=s[i]
  else:
    if(checkDict2[t[i]]!=s[i]):
      flg="No"
    
  
print(flg)

Solution (Python):


S = list(input())
T = list(input())





convList = [0] * 26

ans = 'Yes'




for i in range(len(S)):
    charNo = ord(S[i]) - 97
    matchNo = ord(T[i]) - 97
    if S[i] != T[i]:
        for j in range(len(S)):
            if ord(S[j]) - 97 == charNo:
                
                if S[j] == T[j]:
                    ans = 'No'
                    break
                S[j] = chr((matchNo + 97))

            elif ord(S[j]) - 97 == matchNo:
                
                if S[j] == T[j]:
                    ans = 'No'
                    break

                S[j] = chr((charNo + 97))


        
        

        
        
        
        
        


        convList[charNo] = matchNo
        convList[matchNo] = charNo

print(ans)

Solution (Python):
def main():
    """
    英小文字のみからなる文字列 S, T
    文字列 Sに対して、次の操作を何度でも行うことができます。

    操作
        2つの異なる英小文字 c1, c2を選び、
        Sに含まれる全ての 
        c1 を c2に、
        c2 を c1に、置き換える

    0回以上操作を行って、S を Tに一致させられるか判定

    1 <= |S| = |T| <= 2 * 10^5
    """
    S = input()
    T = input()

    ans = f(S, T)
    print(ans)


if False:
    import pytest

    @pytest.mark.randomize(S=str, T=str,
                           min_length=10, max_length=10,
                           str_attrs=("ascii_lowercase",))
    def test_f(S, T):
        assert f(S, T)


def f(S, T):
    """
    26文字存在しないとき
    S: abc
    T: def
        a -> d にしたい
        dbc
        dはSに存在しないので好きに変えられる, でよいか

    S: abc
    T: ddf
        a -> d: dbc
        b -> d: dが存在する
        bを存在しないものに変える: dzc, 状況は変わらない
        a,b入れ替えても意味がない
        a->x, b->x and x->b: bxc, 状況は変わらない

        割当がかぶっていると無理っぽい

    仮に3文字しか種類がない
    S: abc
    T: cab
        c->a, a->c: cba
        b->a, a->b: cab
    """
    import string
    ds = {c: set() for c in string.ascii_lowercase}
    dt = {c: set() for c in string.ascii_lowercase}
    for c1, c2 in zip(S, T):
        ds[c2].add(c1)
        dt[c1].add(c2)

    for c in string.ascii_lowercase:
        if len(ds[c]) >= 2 or len(dt[c]) >= 2:
            return "No"

    return "Yes"


if __name__ == '__main__':
    main()

Solution (Python):
s=input();S=list(s)
t=input();T=list(t)
l=[chr(ord('a')+j) for j in range(26)]
u=[]
c=0
for i in range(len(s)):
  v=[s[i],t[i]]
  if v not in u:
    u.append(v)
u.sort()
for k in range(len(u)):
  for m in range(len(u)):
    if u[k][0]==u[m][0]:
      if u[k][1]!=u[m][1]:c+=1
for p in range(len(u)):
  for q in range(len(u)):
    if u[p][1]==u[q][1]:
      if u[p][0]!=u[q][0]:c+=1
if c==0:print('Yes')
else:print('No')

Solution (Python):
a = input()
b = input()

c = [0]*26
cc = [0]*26

for i in a:
    c[int(ord(i)-ord('a'))] += 1
    
for i in b:
    cc[int(ord(i)-ord('a'))] += 1
    
    
for i, j in zip(sorted(c), sorted(cc)):
    if i != j:
        print('No')
        break
else:
    print('Yes')

Solution (Python):
s = input()
t = input()

s_dict = {}
t_dict = {}
s_drdp = sorted(set(s), key=s.index)
t_drdp = sorted(set(t), key=t.index)
for i, ss in enumerate(s_drdp):
    s_dict[ss] = i
for i, tt in enumerate(t_drdp):
    t_dict[tt] = i

import numpy as np

def s2vec(d, d_dict):
    return d_dict[d]

vecf = np.vectorize(s2vec)
if list(vecf(list(s), s_dict)) == list(vecf(list(t), t_dict)):
    print('Yes')
else:
    print('No')

Solution (Python):
import sys
import numpy as np
from collections import Counter
s=input()
t=input()
s1=set(s)
t1=set(t)
if s==t:
    print('Yes')
    sys.exit()
qu2=[]
if len(s1)==len(t1):
    for i in s1:
        if s.count(i)>1:
            qu=[j for j,e in enumerate(s) if e==i]
            for j in qu:
                j=int(j)
                qu2.append(t[j])
            qu3=set(qu2)
            if len(qu3)!=1:
                print('No')
                sys.exit()
            else:
                qu3.clear()
        qu2=[]
        qu=[]
    print('Yes')
elif len(s1)!=len(t1):
    print('No')