qyliang/CodeNanoFix huggingface dataset:
Buggy code:
S = input()
T = input()


dict_S = {}

for i in range(len(S)):
  if S[i] in dict_S:
    if dict_S[S[i]] != T[i]:
      print("No")
      exit()
  else:
    dict_S[S[i]] = T[i]
    
print("Yes")

Fixed code:
S = input()
T = input()


dict_S = {}
dict_T = {}

for i in range(len(S)):
  if S[i] in dict_S:
    if dict_S[S[i]] != T[i]:
      print("No")
      exit()
  else:
    dict_S[S[i]] = T[i]
  
  if T[i] in dict_T:
    if dict_T[T[i]] != S[i]:
      print("No")
      exit()
  else:
    dict_T[T[i]] = S[i]
    
print("Yes")
Buggy code:
def solve(S, T):
    StoT = {}
    TtoS = {}
    for s, t in zip(S, T):
        print('----------------')
        print(s, t)
        if s not in StoT:
            StoT[s] = t
        if t not in TtoS:
            TtoS[t] = s
        
        if StoT[s] != t or TtoS[t] != s:
            return False
        print(StoT)
        print(TtoS)

    return True
        


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

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


Fixed code:
def solve(S, T):
    StoT = {}
    TtoS = {}
    for s, t in zip(S, T):
        if s not in StoT:
            StoT[s] = t
        if t not in TtoS:
            TtoS[t] = s
        
        if StoT[s] != t or TtoS[t] != s:
            return False

    return True
        


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

bool = solve(S, T)
if bool:
    print('Yes')
else:
    print('No')
Buggy code:
S=input()
T=input()
al=[chr(ord('a')+i) for i in range(26)]
sameS=[]
sameT=[]

for k in al:
    indexes=[i for i, x in enumerate(S) if x==k]
    sameS.append(indexes)

for k in al:
    indexes=[i for i, x in enumerate(T) if x==k]
    sameT.append(indexes)

if all([x in sameS for x in sameT]) and all([x in sameT for x in sameS]):
    print('Yes')
else:
    print('NO')


Fixed code:
S=input()
T=input()
al=[chr(ord('a')+i) for i in range(26)]
sameS=[]
sameT=[]

for k in al:
    indexes=[i for i, x in enumerate(S) if x==k]
    sameS.append(indexes)

for k in al:
    indexes=[i for i, x in enumerate(T) if x==k]
    sameT.append(indexes)

if all([x in sameS for x in sameT]) and all([x in sameT for x in sameS]):
    print('Yes')
else:
    print('No')
Buggy code:
from collections import defaultdict

S = input()
T = input()

A = {}

isok = True
for i in range(len(S)):
    if S[i] in A:
        if T[i] != A[S[i]]:
            isok = False
            break
    else:
        A[S[i]] = T[i]
        
if isok:
    print("Yes")
else:
    print("No")

Fixed code:
from collections import defaultdict

S = input()
T = input()

A = {}
B = {}

isok = True
for i in range(len(S)):
    if S[i] in A:
        if T[i] != A[S[i]]:
            isok = False
            break
    else:
        A[S[i]] = T[i]
    if T[i] in B:
        if S[i] != B[T[i]]:
            isok = False
            break
    else:
        B[T[i]] = S[i]
        
if isok:
    print("Yes")
else:
    print("No")
Buggy code:
s=input()
t=input()
n=len(s)
d={}
for i in range(n):
    ss=s[i]
    tt=t[i]
    if ss not in d:
        d[ss]=tt
    if ss in d and (ss,tt) not in d.items():
        print("No")
        exit()
    
print("Yes")

Fixed code:
s=input()
t=input()
n=len(s)
d={}
for i in range(n):
    ss=s[i]
    tt=t[i]
    if ss in d and (ss,tt) not in d.items():
        print("No")
        exit()
    if tt in d.values() and (ss,tt) not in d.items():
        print("No")
        exit()
    if ss not in d:
        d[ss]=tt    
print("Yes")
Buggy code:
from collections import defaultdict
S = input()
T = input()
d = defaultdict(str)
ans = 'Yes'
for s, t in zip(S, T):
    if len(d[s]) > 0:
        if d[s] != t:
            ans = 'No'
    if len(d[t]) > 0:
        if d[t] != s:
            ans = 'No'
    d[s] = t
    d[t] = s

print(ans)

Fixed code:
from collections import defaultdict
S = input()
T = input()
s_map = defaultdict(str)
t_map = defaultdict(str)
ans = 'Yes'
for s, t in zip(S, T):
    if len(s_map[s]) > 0:
        if s_map[s] != t:
            ans = 'No'
    if len(t_map[t]) > 0:
        if t_map[t] != s:
            ans = 'No'
    s_map[s] = t
    t_map[t] = s

print(ans)
Buggy code:
from collections import Counter
s = sorted(Counter(input()).values)
t = sorted(Counter(input()).values)
print("Yes" if s==t else "No")

Fixed code:
from collections import Counter
s=sorted(Counter(input()).values())
t=sorted(Counter(input()).values())
print("Yes" if s==t else "No")
Buggy code:
S = input()
T = input()
S_list = [i for i in S]
T_list = [i for i in T]
S_set = set(S_list)
T_set = set(T_list)
def judge():
  if len(S_set)==len(T_set)==len(S_list):
    print(len(S_set),len(T_list),len(S_list))
    return "Yes"
  for car in S_set:
    if [j for j, x in enumerate(T_list) if x == T_list[S_list.index(car)]]!=[j for j, x in enumerate(S_list) if x == car]:
      return "No"
  return "Yes"

print(judge()) 

Fixed code:
S = input()
T = input()
S_list = [i for i in S]
T_list = [i for i in T]
S_set = set(S_list)
T_set = set(T_list)
def judge():
  if len(S_set)==len(T_set)==len(S_list):
    return "Yes"
  for car in S_set:
    if [j for j, x in enumerate(T_list) if x == T_list[S_list.index(car)]]!=[j for j, x in enumerate(S_list) if x == car]:
      return "No"
  return "Yes"

print(judge())
Buggy code:
import sys
from collections import Counter
one=list(input())
#print(one)
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)

print(p)
print(z)

w=[]
for k,v in z.items():
    if len(v)>1:
        result.append(v)
o=[]
for k,v in p.items():
    if len(v)>1:
        o.append(v)
print(w)
print(o)
for i in w:
    if i not in o:
        print("No")
        sys.exit()
print("Yes")

Fixed code:
import sys
from collections import Counter
one=list(input())
#print(one)
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)

#print(p)
#print(z)

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)
#print(w)
#print(o)
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")
Buggy code:
import sys

S = input()
T = input()
alpha_map = {}
talpha_map = {}
for i in range(len(S)):
  s = S[i]
  t = T[i]
  if s in alpha_map:
    if alpha_map[s] != t:
      sys.exit()
  if t in talpha_map:
    if talpha_map[t] != s:
      sys.exit()
  alpha_map[s] = t
  talpha_map[t] = s
print("Yes")

Fixed code:
import sys

S = input()
T = input()
alpha_map = {}
talpha_map = {}
for i in range(len(S)):
  s = S[i]
  t = T[i]
  if s in alpha_map.keys():
    if alpha_map[s] != t:
      print("No")
      sys.exit()
  if t in talpha_map.keys():
    if talpha_map[t] != s:
      print("No")
      sys.exit()
  alpha_map[s] = t
  talpha_map[t] = s
print("Yes")
Buggy code:
s = input()
t = input()
# snum = []
# tnum = []
# for c in range(ord('a'), ord('z') + 1):
#     snum.append([i for i, x in enumerate(s) if x == chr(c)])
# for c in range(ord('a'), ord('z') + 1):
#     tnum.append([i for i, x in enumerate(t) if x == chr(c)])
# snum.sort()
# tnum.sort()
# print('Yes' if snum == tnum else 'No')


sn=[0 for i in range(26)]
tn=[0 for i in range(26)]
for i in range(len(s)):
    sn[ord(s[i])]+=1
    tn[ord(t[i])]+=1
print('Yes' if sorted(sn) == sorted(tn) else 'No')



Fixed code:
s = input()
t = input()
# snum = []
# tnum = []
# for c in range(ord('a'), ord('z') + 1):
#     snum.append([i for i, x in enumerate(s) if x == chr(c)])
# for c in range(ord('a'), ord('z') + 1):
#     tnum.append([i for i, x in enumerate(t) if x == chr(c)])
# snum.sort()
# tnum.sort()
# print('Yes' if snum == tnum else 'No')


sn=[0 for i in range(26)]
tn=[0 for i in range(26)]
for i in range(len(s)):
    sn[ord(s[i])-ord('a')]+=1
    tn[ord(t[i])-ord('a')]+=1
print('Yes' if sorted(sn) == sorted(tn) else 'No')
Buggy code:
import sys

S = input()
T = input()

changes = {}
for i in range(len(T)):
    print(changes)
    if S[i] != T[i]:
        if S[i] in changes:
            if changes[S[i]] != T[i]:
                print('No')
                sys.exit(0)
        if T[i] in changes:
            if changes[T[i]] != S[i]:
                print('No')
                sys.exit(0)

        changes[S[i]] = T[i]
        changes[T[i]] = S[i]

print('Yes')

Fixed code:
import sys

S = input()
T = input()

changes = {}
changes_reverse = {}
for i in range(len(T)):
    #print(changes)
    if S[i] != T[i]:
        if S[i] in changes:
            if changes[S[i]] != T[i]:
                print('No')
                sys.exit(0)
        if T[i] in changes_reverse:
            if changes_reverse[T[i]] != S[i]:
                print('No')
                sys.exit(0)

        changes[S[i]] = T[i]
        changes_reverse[T[i]] = S[i]
    else:
        changes[S[i]] = T[i]
        changes_reverse[T[i]] = S[i]
        

print('Yes')
# print(changes)
Buggy code:
import sys
import itertools
import numpy
input = sys.stdin.readline
Sa = input()
Ta = input()
S = ['0'] * len(Sa)
T = ['0'] * len(Ta)
for i in range(len(Sa)) :
    S[i] = Sa[i]
for i in range(len(Ta)) :
    T[i] = Ta[i]
ans = {}
for cs,ct in zip(S,T) :
    if cs not in ans.keys() and ct not in ans.values() :
        ans[cs] = ct
    else :
        if ans[cs] == ct :
            continue
        else :
            print("No")
            break
else :
    print("Yes")

Fixed code:
import sys
import itertools
import numpy
input = sys.stdin.readline
Sa = input()
Ta = input()
S = ['0'] * len(Sa)
T = ['0'] * len(Ta)
for i in range(len(Sa)) :
    S[i] = Sa[i]
for i in range(len(Ta)) :
    T[i] = Ta[i]
ans = {}
for cs,ct in zip(S,T) :
    if cs not in ans.keys() and ct not in ans.values() :
        ans[cs] = ct
    else :
        try :
            if ans[cs] == ct :
                continue
            else :
                print("No")
                break
        except KeyError :
            print("No")
            break
else :
    print("Yes")
Buggy code:
# INPUT
first_word = input()
second_word = input()

# # PROCESS
answer = "No"
answer_dict = {}
answer_dict2 = {}

def check_dict(dict, val_word, check_word):
  answer_bool = True
  for i in range(len(val_word)):
    if (val_word[i] in answer_dict.keys()):
      if (answer_dict[val_word[i]] != check_word[i]):
        answer_bool = False
        break
    else:
      answer_dict[val_word[i]] = check_word[i]

  return answer_bool

if (check_dict(answer_dict, first_word, second_word) and check_dict(answer_dict2, second_word, first_word)):
  answer = "Yes"

# OUTPUT
print(answer)

Fixed code:
# INPUT
first_word = input()
second_word = input()

# # PROCESS
answer = "No"
answer_dict = {}
answer_dict2 = {}

def check_dict(dic, val_word, check_word):
  answer_bool = True
  for i in range(len(val_word)):
    if (val_word[i] in dic.keys()):
      if (dic[val_word[i]] != check_word[i]):
        answer_bool = False
        break
    else:
      dic[val_word[i]] = check_word[i]

  return answer_bool

check_1 = check_dict(answer_dict, first_word, second_word)
check_2 = check_dict(answer_dict2, second_word, first_word)
if (check_1 and check_2):
  answer = "Yes"

# OUTPUT
print(answer)
Buggy code:
s = list(input())
t = list(input())
pair = []
li =[]
ans = "Yes"

for i in range(len(s)):
    if [s[i],t[i]] in li:
        pass
    else:
        li.append([s[i],t[i]])

def check2(pair,i,li):
    for j in range(len(pair)):
        if (li[i][0]==pair[j][0] and li[i][1]!=pair[j][1])or(li[i][0]!=pair[j][0] and li[i][1]==pair[j][1]):
            return False
    return True

for i in range(len(s)):
    if check2(pair,i,li):
        pair.append([li[i][0],li[i][1]])
    else:
        ans = "No"
        break

print(ans)


Fixed code:
s = list(input())
t = list(input())
pair = []
li =[]
ans = "Yes"

for i in range(len(s)):
    if [s[i],t[i]] in li:
        pass
    else:
        li.append([s[i],t[i]])

def check2(pair,i,li):
    for j in range(len(pair)):
        if (li[i][0]==pair[j][0] and li[i][1]!=pair[j][1])or(li[i][0]!=pair[j][0] and li[i][1]==pair[j][1]):
            return False
    return True

for i in range(len(li)):
    if check2(pair,i,li):
        pair.append([li[i][0],li[i][1]])
    else:
        ans = "No"
        break

print(ans)
Buggy code:
from collections import Counter
s=input()
t=input()
c1=Counter(s)
c2=Counter(t)
c1.sort()
c2.sort()
print('Yes' if c1==c2 else 'No')

Fixed code:
from collections import Counter
s=input()
t=input()
c1=list(Counter(s).values())
c2=list(Counter(t).values())
c1.sort()
c2.sort()
print('Yes' if c1==c2 else 'No')
Buggy code:
S=input()
T=input()
from collections import Counter
s=list(S)
t=list(T)
a=Counter(s)
b=Counter(t)
c=a.most_common()
d=b.most_common()
flag=True
for i in range(len(s)):
    if d[i][1]==1 and c[i][1]==1:
        break
    if d[i][1]>=2 and flag:
        e=[]
        for j in range(len(s)):
            if t[j]==d[i][0]:
                e.append(s[j])
        for j in range(len(e)-1):
            if e[j]!=e[j+1]:
                flag=False
                break
    if c[i][1]>=2 and flag:
        f=[]
        for j in range(len(s)):
            if s[j]==c[i][0]:
                f.append(t[j])
        print(f)
        for j in range(len(f)-1):
            if f[j]!=f[j+1]:
                flag=False
                break
if flag:
    print('Yes')
else:
    print('No')

Fixed code:
from collections import Counter
S=input()
T=input()
s=list(S)
t=list(T)
a=Counter(s)
b=Counter(t)
c=a.most_common()
d=b.most_common()
flag=True
for i in range(min(len(d),len(c))):
    if d[i][1]==1 and c[i][1]==1:
        break
    if d[i][1]>=2 and flag:
        e=[]
        for j in range(len(s)):
            if t[j]==d[i][0]:
                e.append(s[j])
        for j in range(len(e)-1):
            if e[j]!=e[j+1]:
                flag=False
                break
    if c[i][1]>=2 and flag:
        f=[]
        for j in range(len(s)):
            if s[j]==c[i][0]:
                f.append(t[j])
        for j in range(len(f)-1):
            if f[j]!=f[j+1]:
                flag=False
                break
if flag:
    print('Yes')
else:
    print('No')
Buggy code:
def solve():
    S = input()
    T = input()

    spair = {}
    tpair = {}

    for s, t in zip(S, T):
        if s not in spair:
            spair[s] = t
        else:
            if spair[s] != t:
                print("No1")
                exit()
        if t not in tpair:
            tpair[t] = s
        else:
            if tpair[t] != s:
                print("No2")
                exit()

    print("Yes")


if __name__ == "__main__":
    solve()



Fixed code:
def solve():
    S = input()
    T = input()

    spair = {}
    tpair = {}

    for s, t in zip(S, T):
        if s not in spair:
            spair[s] = t
        else:
            if spair[s] != t:
                print("No")
                exit()
        if t not in tpair:
            tpair[t] = s
        else:
            if tpair[t] != s:
                print("No")
                exit()

    print("Yes")


if __name__ == "__main__":
    solve()
Buggy code:
S = input()
T = input()
cnt = 0
for i in range(len(S)):
  if cnt > 30:
    break
  if S[i] != T[i]:
    X = S[i]
    S = S.replace(S[i],"X")
    S = S.replace(T[i],X)
    S = S.replace("X",T[i])
    cnt += 1
  print(S)
print("Yes" if S == T else "No")

Fixed code:
S = input()
T = input()
cnt = 0
for i in range(len(S)):
  if cnt > 30:
    break
  if S[i] != T[i]:
    X = S[i]
    S = S.replace(S[i],"X")
    if T[i] in S:
      S = S.replace(T[i],X)
    S = S.replace("X",T[i])
    cnt += 1
print("Yes" if S == T else "No")
Buggy code:
s=input()
t=input()


ans='Yes'
st=[0]*26
ts=[0]*26
for i in range(len(s)):
    sind = ord(s[i])-ord('a')
    tind = ord(t[i])-ord('a')
    
    if st[sind] == 0:
        st[sind] == t[i]
    if ts[tind] == 0:
        ts[tind] == s[i]
    if st[sind] == t[i] and ts[tind] == s[i]:
        continue
    else:
        ans='No'
        break
    
print(ans)

Fixed code:
s=input()
t=input()


ans='Yes'
st=[0]*26
ts=[0]*26
for i in range(len(s)):
    sind = ord(s[i])-ord('a')
    tind = ord(t[i])-ord('a')
    
    if st[sind] == 0:
        st[sind] = t[i]
    if ts[tind] == 0:
        ts[tind] = s[i]
    
    if st[sind] == t[i] and ts[tind] == s[i]:
        continue
    else:
        ans='No'
        break
    
print(ans)
Buggy code:
s=input().strip()
t=input().strip()
s_list=[]
t_list=[]
for char in s:
    s_list.append(char)
for char in t:
    t_list.append(char)
s_collection=collections.Counter(s_list)
t_collection=collections.Counter(t_list)
s_countlist=[]
t_countlist=[]
for entry in s_collection.values():
    s_countlist.append(entry)
for entry in t_collection.values():
    t_countlist.append(entry)
s_countlist.sort()
t_countlist.sort()
if s_countlist == t_countlist:
    print("Yes")
else:
    print("No")

Fixed code:
import collections
s=input().strip()
t=input().strip()
s_list=[]
t_list=[]
for char in s:
    s_list.append(char)
for char in t:
    t_list.append(char)
s_collection=collections.Counter(s_list)
t_collection=collections.Counter(t_list)
s_countlist=[]
t_countlist=[]
for entry in s_collection.values():
    s_countlist.append(entry)
for entry in t_collection.values():
    t_countlist.append(entry)
s_countlist.sort()
t_countlist.sort()
if s_countlist == t_countlist:
    print("Yes")
else:
    print("No")
Buggy code:
s=input()
t=input()

st=[]
for i in range(len(s)):
    st.append([s[i],t[i]])
#print(st)
st.sort()
#print(st)
    
for i in range(len(st)-1):
    if st[len(st)-i-1]==st[len(st)-i-2]:
        del st[len(st)-i-1]
        
#print(st)

yesno="Yes"
for i in range(len(st)-1):
    sj,tj=st[len(st)-i-1]
    sk,tk=st[len(st)-i-2]
    if sj==sk and tj!=tk:
        yesno="No"
        break
    
print(yesno)

Fixed code:
s=input()
t=input()

st=[]
ts=[]
for i in range(len(s)):
    st.append([s[i],t[i]])
    ts.append([t[i],s[i]])
#print(st)
st.sort()
ts.sort()
#print(st)
    
yesno="Yes"
for i in range(len(st)-1):
    sj,tj=st[len(st)-i-1]
    sk,tk=st[len(st)-i-2]
    if sj==sk and tj!=tk:
        yesno="No"
        break
    tj,sj=ts[len(ts)-i-1]
    tk,sk=ts[len(ts)-i-2]
    if tj==tk and sj!=sk:
        yesno="No"
        break
    
print(yesno)
Buggy code:
S=input()
T=input()
L=len(S)
AZ="ABCDEFGHIJKLMNOPQRSTUVWXYZ"
j=0
for i in range(L):
	if S[i:i+1].islower()==True:
		S=S.replace(S[i],AZ[j])
		j=j+1
print(S)
k=0
for i in range(L):
	if T[i:i+1].islower()==True:
		T=T.replace(T[i],AZ[k])  
		k=k+1
print(T)
if S==T:
	print("Yes")
else:
	print("No")

Fixed code:
S=input()
T=input()
L=len(S)
AZ="ABCDEFGHIJKLMNOPQRSTUVWXYZ"
j=0
for i in range(L):
	if S[i:i+1].islower()==True:
		S=S.replace(S[i],AZ[j])
		j=j+1
k=0
for i in range(L):
	if T[i:i+1].islower()==True:
		T=T.replace(T[i],AZ[k])  
		k=k+1
if S==T:
	print("Yes")
else:
	print("No")
Buggy code:
from collections import defaultdict as dd
s=input()
t=input()
ds=dd(int)
dt=dd(int)
for ss,tt in zip(s,t):
    ds[ss]+=1
    ds[tt]+=1
cs,ct=[],[]

for v in ds.values():
    cs.append(v)
for v in dt.values():
    ct.append(v)
cs.sort()
ct.sort()

for sss,ttt in zip(cs,ct):
    if sss!=ttt:
        print('No')
        exit()
print('Yes')


Fixed code:
from collections import defaultdict as dd
s=input()
t=input()
ds=dd(int)
dt=dd(int)
for ss in s:
    ds[ss]+=1
for tt in t:
    dt[tt]+=1
cs,ct=[],[]

for v in ds.values():
    cs.append(v)
for v in dt.values():
    ct.append(v)
cs.sort()
ct.sort()

for sss,ttt in zip(cs,ct):
    if sss!=ttt:
        print('No')
        exit()
print('Yes')
Buggy code:
import sys

S = input()
T = input()

len_S = len(S)
S_Converted = S
for i in range (len(S)):
    tmp_S = S_Converted[i]
    tmp_T = T[i]
    if tmp_S == tmp_T:
        continue
    S_Converted = list(S_Converted) 
    list_indexT = [j for j, tmp_SC in enumerate(S_Converted) if tmp_SC == tmp_T]
    if (not list_indexT == []) and (list_indexT[0] < i):
        print('No')
        sys.exit()
    S_Converted = ''.join(S_Converted)
    S_Converted = S_Converted.replace(tmp_S, tmp_T)
    S_Converted = list(S_Converted) 
    for li in list_indexT:
        if li == i:
            continue
        else:
            S_Converted[li] = tmp_S
    print(''.join(S_Converted))
    
S_Converted = ''.join(S_Converted)

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

    

Fixed code:
import sys

S = input()
T = input()

len_S = len(S)
S_Converted = S
for i in range (len(S)):
    tmp_S = S_Converted[i]
    tmp_T = T[i]
    if tmp_S == tmp_T:
        continue
    S_Converted = list(S_Converted) 
    list_indexT = [j for j, tmp_SC in enumerate(S_Converted) if tmp_SC == tmp_T]
    if (not list_indexT == []) and (list_indexT[0] < i):
        print('No')
        sys.exit()
    S_Converted = ''.join(S_Converted)
    S_Converted = S_Converted.replace(tmp_S, tmp_T)
    S_Converted = list(S_Converted) 
    for li in list_indexT:
        if li == i:
            continue
        else:
            S_Converted[li] = tmp_S
    #print(''.join(S_Converted))
    
S_Converted = ''.join(S_Converted)

if S_Converted == T:
    print('Yes')
else:
    print('No')
Buggy code:
import string

S = input()
T = input()

count1 = [0] * 26
count2 = [0] * 26


for j in range(25):
    count1[j] = S.count(string.ascii_lowercase[j])
    count2[j] = T.count(string.ascii_lowercase[j])

hantei = 1

for i in range(1,len(S)+1):
    count_tmp1 = 0
    count_tmp2 = 0
    for j in range(25):
        if i == count1[j] :
            count_tmp1 += 1
        elif i == count2[j] :
            count_tmp2 += 1
    if count_tmp1 != count_tmp2:
        hantei = 0
        break

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

Fixed code:
import string

S = input()
T = input()

count1 = [0] * 26
count2 = [0] * 26


for j in range(26):
    count1[j] = S.count(string.ascii_lowercase[j])
    count2[j] = T.count(string.ascii_lowercase[j])

hantei = 1

for i in range(0,len(S)+1):
    count_tmp1 = 0
    count_tmp2 = 0
    for j in range(26):
        if i == count1[j] :
            count_tmp1 += 1
    for j in range(26):
        if i == count2[j] :
            count_tmp2 += 1
    if count_tmp1 != count_tmp2:
        hantei = 0
        break

if hantei == 0:
    print("No")
else:
    print("Yes")
Buggy code:
    s = input()
    t = input()

    ds = dict()
    dt = dict()
    tr = dict()
    tr2 = dict()
    res = True
    for i in range(len(s)):
        ds[s[i]] = True
        dt[s[i]] = True
        if s[i] not in tr:
            tr[s[i]] = t[i]
        else:
            if tr[s[i]] != t[i]:
                res = False

        if t[i] not in tr2:
            tr2[t[i]] = s[i]
        else:
            if tr2[t[i]] != s[i]:
                res = False

    #if (len(ds) == 26 or len(dt) == 26) and ds != dt:
    #    res = False

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


Fixed code:
s = input()
t = input()

ds = dict()
dt = dict()
tr = dict()
tr2 = dict()
res = True
for i in range(len(s)):
    ds[s[i]] = True
    dt[s[i]] = True
    if s[i] not in tr:
        tr[s[i]] = t[i]
    else:
        if tr[s[i]] != t[i]:
            res = False

    if t[i] not in tr2:
        tr2[t[i]] = s[i]
    else:
        if tr2[t[i]] != s[i]:
            res = False

if (len(ds) == 26 or len(dt) == 26) and ds != dt:
    res = False

print("Yes" if res else "No")
Buggy code:
s = input()
t = input()
d = {}
for i in range(len(s)):
  if s[i] in d:
    if d[s[i]] != t[i]:
      print("No")
      break
  else:
    d[s[i]] = t[i]
print("Yes")


Fixed code:
s = input()
t = input()
d = {}
d2 = {}
for i in range(len(s)):
  if t[i] in d:
    if d[t[i]] != s[i]:
      print("No")
      break
  if s[i] in d2:
    if d2[s[i]] != t[i]:
      print("No")
      break
  else:
    d[t[i]] = s[i]
    d2[s[i]] = t[i]
else:
  print("Yes")
Buggy code:
s=input()
n=input()
d=dict()
ans="Yes"
for i in range(len(s)):
  if s[i] not in d:
    d[s[i]]=n[i]
  elif d[s[i]]!=n[i]:
    ans="No"
print(ans)

Fixed code:
s=input()
n=input()
d=dict()
dd=dict()
ans="Yes"
for i in range(len(s)):
  if s[i] not in d:
    d[s[i]]=n[i]
  elif d[s[i]]!=n[i]:
    ans="No"
  if n[i] not in dd:
    dd[n[i]]=s[i]
  elif dd[n[i]]!=s[i]:
    ans="No"
print(ans)