TnT/Multi_CodeNet4Repair huggingface dataset:
Problem: 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.

Submission attempts (in order):
import sys
s=input()
t=input()

def c(a,b,s,t):
    li=""
    j=0
    for i in s:
        if i==a:
            li+=b
            if t[j]!=b:
                print("No")
                sys.exit()
        elif i==b:
            li+=a
        else:
            li+=i
        j+=1
    return li
    

for i in range(len(t)):
    if s[i]!=t[i]:
        l.append(t[i])
        s=c(s[i],t[i],s,t)
    
        

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

import sys
s=input()
t=input()

def c(a,b,s,t):
    li=""
    j=0
    for i in s:
        if i==a:
            li+=b
            if t[j]!=i:
                print("No")
                sys.exit()
        elif i==b:
            li+=a
        else:
            li+=i
        j+=1
    return li
    
l=[]

for i in range(len(t)):
    if s[i]!=t[i]:
        for j in l:
            if s[i]==j:
                print("No")
                sys.exit()
        l.append(t[i])
        s=c(s[i],t[i],s,t)
    
        

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

s=input()
t=input()


def f(s):
    l=[]
    a="abcdefghijklmnopqrstuvwxyz"
    r=""
    for i in range(len(s)):
        if s[i] in l:
            for j in range(len(l)):
                if s[i]==l[j]:
                    r+=a[j]
        else:
            r+=a[len(l)]
            l.append(s[i])
    return r

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


Verdicts: Runtime Error

Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
S = input()
T = input()
ans = "Yes"
start = [-1]*26
goal = [-1]*26
for i in range(len(S)):
    s,t = ord(S[i])-96,ord(T[i])-96
    if start[s]!=-1 or goal[t]!=-1:
        if start[s]!=t or goal[t]!=s:
            ans = "No"
    else:
        start[s] = t
        goal[t] = s
print(ans)

S = input()
T = input()
ans = "Yes"
start = [-1]*26
goal = [-1]*26
for i in range(len(S)):
    s,t = ord(S[i])-97,ord(T[i])-97
    if start[s]!=-1 or goal[t]!=-1:
        if start[s]!=t or goal[t]!=s:
            ans = "No"
    else:
        start[s] = t
        goal[t] = s
print(ans)

Verdicts: Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
from collections import defaultdict
if __name__ == '__main__':
    S = str(input())
    T = str(input())
    
    count = defaultdict(str)
    
    flag = True
    for i in range(len(S)):
        s = S[i]
        t = T[i]
        if count[t] != '':
            if count[t] != s:
                flag = False
        else:
            count[t] = s
    if flag:
        print(1/0)
        print('Yes')
    else:
        print('No')

from collections import defaultdict
if __name__ == '__main__':
    S = str(input())
    T = str(input())
    
    count = defaultdict(str)
    count2 = defaultdict(str)
    flag = True
    for i in range(len(S)):
        s = S[i]
        t = T[i]
        if count[t] != '':
            if count[t] != s:
                flag = False
        else:
            if count2[s] != '':
                if count2[s] != t:
                    flag = False
            else:
                count[t] = s
                count2[s] = t
    if flag:
        print('Yes')
    else:
        print('No')

Verdicts: Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
from collections import Counter

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

# counter_S = []
# counter = 1
# p = S[0]

#     if p != S[i]:
#         counter_S.append(counter)
#         p = S[i]
#         counter = 1
#     else:
#         counter += 1
# counter_S.append(counter)
#
# counter_T = []
# counter = 1
# p = T[0]

#     if p != T[i]:
#         counter_T.append(counter)
#         p = T[i]
#         counter = 1
#     else:
#         counter += 1
# counter_T.append(counter)

counter_S = []
counter_T = []
count_S = 1
count_T = 1
p_S = S[0]
p_T = T[0]
for i in range(1, N):
    if p_S != S[i]:
        counter_S.append(count_S)
        p_S = S[i]
        count_S = 1
    else:
        count_S += 1
    if p_T != T[i]:
        counter_T.append(count_T)
        p_T = T[i]
        count_T = 1
    else:
        count_T += 1
counter_S.append(count_S)
counter_T.append(count_T)

print(counter_S)
print(counter_T)

length_CS = len(counter_S)
length_CT = len(counter_T)

if length_CS != length_CT:
    print("No")
else:
    flag = True
    for i in range(length_CS):
        if counter_S != counter_T:
            flag = False
            break
    if flag:
        print("Yes")
    else:
        print("No")


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

dict_S = {}
dict_T = {}

for i in range(N):
    # print("dict_S: {}".format(dict_S))
    # print("dict_T: {}".format(dict_T))
    if S[i] in dict_S:
        if dict_S[S[i]] != T[i]:
            print("No")
            exit()
    if T[i] in dict_T:
        if dict_T[T[i]] != S[i]:
            print("No")
            exit()
    dict_S[S[i]] = T[i]
    dict_T[T[i]] = S[i]
print("Yes")


Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
s = list(input())
t = list(input())
dic = {}
flg = 'Yes'
for i in range(len(s)):
    if s[i] in dic.keys():
        if t[i] !=  dic.values(s[i]):
            flg = 'No'
    else:
        dic[s[i]] = t[i]
print(flg)

s = list(input())
t = list(input())
dic = {}
flg = 'Yes'
for i in range(len(s)):
    if s[i] in dic.keys():
        if dic[s[i]] != t[i]:
            flg = 'No'
    else:
        dic[s[i]] = t[i]
dic2 = {}
for i in range(len(s)):
    if t[i] in dic2.keys():
        if dic2[t[i]] != s[i]:
            flg = 'No'
    else:
        dic2[t[i]] = s[i]
#print(dic)
print(flg)

Verdicts: Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
from itertools import*;i=lambda:sorted([len(list(v))for k,v in groupby(input()]);print('YNeos'[i()!=i()::2])

from collections import*
e=defaultdict(list)
d=defaultdict(list)
for k,v in enumerate(input()):
    e[v].append(k)
for k,v in enumerate(input()):
    d[v].append(k)
if set(map(tuple,e.values()))==set(map(tuple,d.values())):
    print("Yes")
else:
    print("No")

Verdicts: Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
import sys
input = sys.stdin.readline


def readstr():
    return input().strip()


def readint():
    return int(input())


def readnums():
    return map(int, input().split())


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


def main():
    S = readstr()
    T = readstr()
    sl = dict()
    for i, s in enumerate(S):
        if s == T[i]:
            continue
        else:
            if s in sl.keys():
                if sl[s] != T[i]:
                    print('No')
                    sys.exit()
            elif s in sl.values():
                print('No')
                sys.exit()
            else:
                if T[i] in sl.values():
                    print('No')
                    sys.exit()
                else:
                    sl[s] = T[i]

    print('Yes')


if __name__ == "__main__":
    main()


import sys
input = sys.stdin.readline


def readstr():
    return input().strip()


def readint():
    return int(input())


def readnums():
    return map(int, input().split())


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


def main():
    S = readstr()
    T = readstr()

    sl = dict()
    tl = dict()
    for s, t in zip(S, T):
        if s not in sl:
            sl[s] = t
        else:
            if sl[s] != t:
                print('No')
                break

        if t not in tl:
            tl[t] = s
        else:
            if tl[t] != s:
                print('No')
                break
    else:
        print('Yes')


if __name__ == "__main__":
    main()


Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
from collections import*
f=lambda:sorted(Counter(input()).values())
print("YNEOS"[f()!=f()::2])

from collections import*
f=lambda:sorted(Counter(input()).values())
print("YNeos"[f()!=f()::2])

Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
mod = 10 ** 9 + 7
n, m = map(int, input().split())

f = []
p = 2
while p * p <= m:
    if m % p != 0:
        p += 1
        continue
    c = 0
    while m % p == 0:
        c += 1
        m //= p
    f.append(c)
    p += 1
if m != 1:
    f.append(1)


def comb(a, b):
    ret = 1
    r = min(b, a-b)
    for i in range(a-r+1, a+1):
        ret *= i
    for j in range(1, r+1):
        ret //= j
    return (int)(ret)


ans = 1
for i in f:
    c = 1
    for j in range(i):
        c = c * (n+j) // (j+1)
    ans *= c
print(ans % mod)


import collections
s=(str)(input())
t=(str)(input())

s_c=collections.Counter(s)
s_t=collections.Counter(t)
for i in range(len(s_c)):
    if s_c.get(s[i]) != s_t.get(t[i]):
        print("No")
        exit()
print("Yes")


Verdicts: Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
import collections


s=str(input())
t=str(input())

sa=list(s)
ta=list(t)

asa=collections.Counter(sa)
ata=collections.Counter(ta)

casa=[i[0] for i in asa.items() if i[1] >= 2]

cata=[i[0] for i in ata.items() if i[1] >= 2]
#print(casa)
#print(cata)
if casa==[] and cata==[]:
    print("Yes")
    exit()


    

import collections 

s=input()
t=input()
s= collections.Counter(s)
t= collections.Counter(t)
#print(s)
sans=[]
tans=[]

for v in s.values():
    sans.append(v)
for v in t.values():
    tans.append(v)
sans.sort()
tans.sort()
#print(sans,tans)
if sans==tans:
    print('Yes')
else:
    print('No')


Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
S = input()
T = input()
f = [-1 for _ in range(130)]
g = [-1 for _ in range(130)]
ans = "Yes"
for i in len(S):
  s = ord(S[i])
  t = ord(T[i])
  if f[s] == -1:
    f[s] = t
  else:
    if f[s] != t:
      ans = "No"
  if g[t] == -1:
    g[t] = s
  else:
    if g[t] != s:
      ans = "No"
print(ans)

S = input()
T = input()
f = [-1 for _ in range(130)]
g = [-1 for _ in range(130)]
ans = "Yes"
for i in range(len(S)):
  s = ord(S[i])
  t = ord(T[i])
  if f[s] == -1:
    f[s] = t
  else:
    if f[s] != t:
      ans = "No"
  if g[t] == -1:
    g[t] = s
  else:
    if g[t] != s:
      ans = "No"
print(ans)


Verdicts: Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
s1 = input()
s2 = input()
if len(s1) != len(s2):
    print("No")
else:
    D1 = {}
    D2 = {}
    flag = True
    for x, y in zip(s1, s2):
        if x not in D1:
            D1[x] = y
        else:
            flag = (flag and (D1[x] == [y]))
        if y not in D2:
            D2[y] = x
        else:
            flag = (flag and (D2[y] == [x]))
        if not flag:
            break
    if flag:
        print("Yes")
    else:
        print("No")

s1 = input()
s2 = input()
if len(s1) != len(s2):
    print("No")
else:
    D1 = {}
    D2 = {}
    flag = True
    for x, y in zip(s1, s2):
        if x not in D1:
            D1[x] = y
        else:
            flag = (flag and (D1[x] == y))
        if y not in D2:
            D2[y] = x
        else:
            flag = (flag and (D2[y] == x))
        if not flag:
            break
    if flag:
        print("Yes")
    else:
        print("No")

Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
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 = memo.values()
if set(a) != len(a):
    ans = 'No'
print(ans)

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)

Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
S=input()
T=input()
Skey=sorted(S,key=S.index)
Tkey=sorted(t,ket=T.index)

for index,i in enumerate(Skey):
  S=S.replace(i,str(index))
for index,i in enumerate(Tkey):
  T=T.replace(i,str(index))

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


S=input()
T=input()
Skey,Tkey=[],[]
for i in range(len(S)):
  Skey.append(S[i])
  Tkey.append(T[i])

for index,i in enumerate(Skey):
  S=S.replace(i,str(index))
for index,i in enumerate(Tkey):
  T=T.replace(i,str(index))
print(S,T)

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


S=input()
T=input()
Skey=sorted(set(S),key=S.index)
Tkey=sorted(set(T),key=T.index)

for index,i in enumerate(Skey):
  S=S.replace(i,str(index))
for index,i in enumerate(Tkey):
  T=T.replace(i,str(index))

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


Verdicts: Runtime Error

Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
import sys
from collections import defaultdict
input = sys.stdin.readline

S = input().strip()
T = input().strip()
dic = defaultdict(list)

def check(d):
    for k, i in d.items():
        if k != i:
            return False
    else:
        return True

for s, t in zip(S, T):
    if t not in dic[s]:
        dic[s].append(t)

for k, i in dic.items():
    if len(i) > 1:
        print('No')
        exit()
    else:
        dic[k] = i[0]

for k, i in dic.items():
    if i not in dic:
        dic[i] = i
        del dic[k]
    else:
        dic[k], dic[i] = k, i
if check(dic):
    print('Yes')
else:
    print('No')

import sys
input = sys.stdin.readline

S = input().strip()
T = input().strip()

dic = defaultdict(list)

def check(d):
    for k, i in d.items():
        if k != i:
            return False
    else:
        return True

for s, t in zip(S, T):
    if s not in dic:
        dic[s] = t
    elif dic[s] != t:
        print('No')
        exit()

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

import sys
from collections import defaultdict
input = sys.stdin.readline

S = input().strip()
T = input().strip()

dic = defaultdict(list)

def check(d):
    for k, i in d.items():
        if k != i:
            return False
    else:
        return True

for s, t in zip(S, T):
    if t not in dic[s]:
        dic[s].append(t)

for k, i in dic.items():
    if len(i) > 1:
        print('No')
        exit()
    else:
        dic[k] = i[0]

c = 0
while c <= 100:
    for k, i in dic.items():
        if i not in dic:
            dic[i] = i
            del dic[k]
        else:
            dic[k], dic[i] = k, i
    c += 1

if check(dic):
    print('Yes')
else:
    print('No')

import sys
input = sys.stdin.readline

S = input().strip()
T = input().strip()
dic = {}

for s, t in zip(S, T):
    if s not in dic:
        dic[s] = t
    elif dic[s] != t:
        print('No')
        exit()

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

Verdicts: Wrong Answer

Runtime Error

Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
import sys
from collections import defaultdict
s = input()
t = input()
d1 = defaultdict(set)
d2 = defaultdict(set)

for i in range(len(s)):
    d1[t[i]].add(s[i])
    d2[s[i]].add(t[i])
    print(d1,d2)
    if len(d1[t[i]])>1 or len(d2[s[i]])>1:
        print("No")
        sys.exit()
print("Yes")


import sys
from collections import defaultdict
s = input()
t = input()
d1 = defaultdict(set)
d2 = defaultdict(set)

for i in range(len(s)):
    d1[t[i]].add(s[i])
    d2[s[i]].add(t[i])
    if len(d1[t[i]])>1 or len(d2[s[i]])>1:
        print("No")
        sys.exit()
print("Yes")


Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
s = input()
t = input()

for i in range(len(s)):
    if s[i] == t[i]:
        continue
    else:
        s = s.translate(str.maketrans({s[i]: t[i], t[i]: s[i]}))
if s == t:
    print("yes")
else:
    print("no")

S = input()
T = input()
Sdictionary = {}
Tdictionary = {}
ans = "Yes"
for i in range(len(S)):
    if T[i] in Tdictionary:
        if Tdictionary[T[i]] == S[i]:
            continue
        else:
            ans = "No"
    else:
        Tdictionary[T[i]] = S[i]
    if S[i] in Sdictionary:
        if Sdictionary[S[i]] == T[i]:
            continue
        else:
            ans = "No"
    else:
        Sdictionary[S[i]] = T[i]


print(ans)


Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
S=input()
T=input()
A=[]
B=[]
c,d=0,0
for i in range(len(S)):
  if S[i]==S[i+1]:
    c+=1
  else:
    A.append(c)
    c=0

for i in range(len(T)):
  if T[i]==T[i+1]:
    d+=1
  else:
    B.append(d)
    d=0
print("Yes" if A==B else "No")

S=input()
T=input()
Rs=[-1]*26
Rt=[-1]*26
for i in range(len(S)):
  a=ord(S[i])-ord("a")
  b=ord(T[i])-ord("a")
  if Rs[a]==-1:
    Rs[a]=b
  elif Rs[a]!=b:
    print("No")
    exit()
  if Rt[b]==-1:
    Rt[b]=a
  elif Rt[b]!=a:
    print("No")
    exit()
print("Yes")

Verdicts: Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
str1 = list(input())
str2 = list(input())

n = len(str1)

for i in range(n):
    if str1[i]==str2[i]:
        continue
    for j in range(i+1,n):
        if str1[j]==str1[i]:
            tmp = str2[i]
            str2[i] = str1[j]
            str1[j] = tmp
            break
        elif str2[j] == str1[i]:
            tmp = str2[j]
            str2[j] = str1[i+1]
            str1[i+1] = str2[i]
            str2[i] = tmp
            break
str1 = ''.join(str1)
str2 = ''.join(str2) 

if(str1 == str2):
    print("YES")
else:
    print("NO")


str1 = list(input())
str2 = list(input())

n = len(str1)

str1 = ''.join(str1)
str2 = ''.join(str2) 
if (str1 == str2):
    print("No")
    exit(0)
for i in range(n):
    if str1[i]==str2[i]:
        continue
    for j in range(i+1,n):
        if str1[j]==str1[i]:
            tmp = str2[i]
            str2[i] = str1[j]
            str1[j] = tmp
            break
        elif str2[j] == str1[i]:
            tmp = str2[j]
            str2[j] = str1[i+1]
            str1[i+1] = str2[i]
            str2[i] = tmp
            break
str1 = ''.join(str1)
str2 = ''.join(str2) 

if(str1 == str2):
    print("Yes")
else:
    print("No")


str1 = input()
str2 = input()

n = len(str1)
d1 = dict()
d2 = dict()
for i in range(26):
    d1[chr(97+i)] = ''
    d2[chr(97+i)] = ''
res = "Yes"
for i in range(n):
    if d1[str1[i]] != '' and d1[str1[i]]!=str2[i]:
        res = "No"
        break
    if d2[str2[i]] != '' and d2[str2[i]]!=str1[i]:
        res = "No"
        break
    if d1[str1[i]] == '':
        d1[str1[i]] = str2[i]
    if d2[str2[i]] == '':
        d2[str2[i]] = str1[i]
print(res)


Verdicts: Wrong Answer

Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
S = str(input())
T = str(input())
alp = "abcdefghijklmnopqrstuvwxyz"
for i in range(0,len(S)//2):
  if S[i] != T[i]:
    S = S.translate(str.maketrans({S[i]:T[i], T[i]:S[i]}))
  if S == T:
    print("Yes")
    exit()
print("No")

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")

Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
a=input()
b=input()

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

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

print('Yes')


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')


Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
import numpy as np
import copy

def main():
    data0 = np.array(list(input()))
    data1 = np.array(list(input()))

    flag = True
    data_tmp = data0
    count = 0
    len_data = len(data0)
    while(count <= len_data):
        if not list(data0):
            break
        count += 1
        c0 = data0[0]
        c1 = data1[0]
        if np.allclose(data0 == c0, data1 == c1)
            data0 = data0[data0 != c0]
            data1 = data1[data1 != c1]
        else:
            flag = False

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



def swap(data, c0, c1):
    data_tmp = copy.copy(data)
    data_tmp[data == c0] = c1
    data_tmp[data == c1] = c0
    return data_tmp

if __name__ == "__main__":
    main()


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()


Verdicts: Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):

s = input()
t = input()
sd, td = {}, {}
for i in range(len(s)):
    if s[i] not in sd and t[i] not in td:
        sd[s[i]] = t[i]
        td[t[i]] = s[i]
    else:
        # if sd[s[i]] != t[i] or td[t[i]] != s[i]:
        if s[i] in sd and t[i] in td:
            pass
        else:
            print("No")
            exit()

for k in sd.keys():
    if k in sd.values():
        print("No")
        exit()

print("Yes")



# c->r, r->c = rhokudai





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")


Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
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

print(d)
print(len(d))
print(len(set(d.values())))


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



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")



Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
from math import sqrt, ceil, factorial
from collections import Counter

m = 10**9+7
def is_prime(n):
    if n == 1: return False
    if n == 2: return True
    for i in range(2, ceil(sqrt(n))+1):
        if n % i == 0: return False
    return True

def prime_factorization(n):
    if is_prime(n):return [n]
    factor = []
    f = 2
    while n > 1:
        if n % f == 0:
            factor.append(f)
            n /= f
        else:
            f += 1
    return factor

def comb(n, r):
    a = 1
    for i in range(n-r+1, n+1):
        a *= i
    return a//factorial(r)

N, M = map(int, input().split())
p = prime_factorization(M)
c = Counter(p)
ans = 1
for v in c.values():
    ans *= (comb(v + N - 1, v) % m)
print(ans%m)

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)

Verdicts: Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
Ga={}
Gb={}
A=list(input())
B=list(input())
flag = True
for i in range(len(A)):
  if A[i] in Ga and Ga[A[i]] != B[i]:
    flag = False
    break
  else:
    Ga[A[i]] = B[i]
for i in range(len(B)):
  if B[i] in Gb and Gb[B[i]] != A[i]:
    flag = False
    break
  else:
    Gb[B[i]] = A[i]
if flag:
  print("yes")
else:
  print("no")

import sys
Ga={}
Gb={}
A=list(input())
B=list(input())
for i in range(len(A)):
  if A[i] in Ga and Ga[A[i]] != B[i]:
    print("No")
    sys.exit()
  else:
    Ga[A[i]] = B[i]
for i in range(len(B)):
  if B[i] in Gb and Gb[B[i]] != A[i]:
    print("No")
    sys.exit()
  else:
    Gb[B[i]] = A[i]
print("Yes")

Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
S = input()
T = input()

U = set()
for s, t in sorted(zip(S, T)):
  U.add((s, t))

for x, y in zip(U[0:-1], U[1:]):
  if x == y:
    print("No")
    break
else:
  print("Yes")

  



S = input()
T = input()

U = set()
for s, t in sorted(zip(S, T)):
  U.add((s, t))

U = sorted(U)
print(U)
for x, y in zip(U[0:-1], U[1:]):
  if x[0] == y[0]:
    print("No")
    break
else:
  print("Yes")


S = input()
T = input()
TS = list(zip(T, S))

TS_set = set()
for t,s in TS:
  TS_set.add((t,s))

S_set = set()
for x in TS_set:
  S_set.add(x[1])

T_set = set()
for x in TS_set:
  T_set.add(x[0])

print("Yes" if S == T or len(TS_set) == len(S_set) == len(T_set) else "No")


Verdicts: Runtime Error

Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
s = input()
t = input()

i = 0
his = []
length = len(s)
flag = True
for i in range(0, length-1):
	ss = s[i:i+1]
	tt = t[i:i+1]
	if ss != tt:
		if tt in his:
			flag = False
			break
		else:
			his.append(tt)
			it1 = re.finditer(ss, s)
			it2 = re.finditer(tt, s)
			for match in it1:
				s = s[:match.start()] + tt + s[match.end():]
			for match in it2:
				s = s[:match.start()] + ss + s[match.end():]

if flag:
	print("Yes")
else:
	print("No")


s = input()
t = input()

start = [-1] * 26
goal = [-1] * 26
flag = True
length = len(s)
dict = { chr(97 + i):i for i in range(26) }
for i in range(0, length):
	a = dict[s[i]]
	b = dict[t[i]]

	if start[a] != -1 or goal[b] != -1:
		if start[a] != b or goal[b] != a:
			flag = False
			break
	else:
		start[a] = b;
		goal[b] = a;
if flag:
	print("Yes")
else:
	print("No")

Verdicts: Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
S = list(input())
T = list(input())
dics ={}
dic ={}
for i in range(len(S)):
  if S[i] in dics:
  	dics[S[i]]=[dics[S[i]],i]
  else :
    dics[S[i]]=[i]
  if T[i] in dic:
    dic[T[i]]=[dic[T[i]],i]
  else:
    dic[T[i]]=[i]
print(dic)
for i in range(len(S)):
  if dics[S[i]]!=dic[T[i]] and (T[i] in dics and dics[T[i]]!=dic[S[i]]):
    print("No")
    exit()
print("Yes")
  

S = list(input())
T = list(input())
dics ={}
dic ={}
for i in range(len(S)):
  if S[i] in dics:
  	dics[S[i]].append(i)
  else :
    dics[S[i]]=i
  if T[i] in dic:
  	dic[T[i]].append(i)
  else:
    dic[T[i]]=i
for i in range(len(S)):
  if dics[S[i]]!=dic[T[i]] and (T[i] in dics and dics[T[i]]!=dic[S[i]]):
    print("No")
    exit()
print("Yes")

  

S=input()
T=input()
convert = {}
flag=1
for s,t in zip(S,T):
  if s in convert and convert[s]!=t:
    flag=0
    break
  convert[s] = t
after = convert.values()
if len(after)!= len(set(after)):
  flag = 0

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

Verdicts: Runtime Error

Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
s = list(input())
t = list(input())
s = list(set(s))
t = list(set(t))
if len(s) == len(t):
    for i in range(len(s)):
        if s[i] == t[i]:
            print("No")
            exit()
        else:
            print("Yes")
else:
    print("No")


s = list(input())
t = list(input())
x = list(set(s))
y = list(set(t))
a = []
b = []

for i in range(len(set(s))):
    a.append(s.count(x[i]))
    
for j in range(len(set(t))):
    b.append(t.count(y[j]))
    
a.sort()
b.sort()

if a == b:
    print("Yes")
else:
    print("No")


Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
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')


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')

Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
import sys

S = input()
T = input()

d = {}

for i in range(len(S)):
    if T[i] in d and d[T[i]]!=S[i]:
        print("NO")
        sys.exit()
    d[T[i]] = S[i]
print("YES")

import sys

S = input()
T = input()

d_T = {}
d_S = {}

for i in range(len(S)):
    if T[i] in d_T and d_T[T[i]]!=S[i]:
        print("No")
        sys.exit()
    d_T[T[i]] = S[i]

for i in range(len(T)):
    if S[i] in d_S and d_S[S[i]]!=T[i]:
        print("No")
        sys.exit()
    d_S[S[i]] = T[i]


print("Yes")

Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
from collections import Counter

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

cs = sorted(Counter(S).values())
ct = sorted(Counter(T).values())

print(cs)
print(ct)

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

import numpy as np
S = str(input())
T = str(input())

S_and_T = list(set(S) & set(T))
#S_T = list(set(S)-set(S_and_T))
#T_S = list(set(T)-set(S_and_T))
if len(S) != len(T):
    print("NO")

elif len(S_and_T) == 0:
    print("YES")
    exit()

elif len(set(S)) != len(set(T)):
    print("NO")

else:
    print("YES")


from collections import Counter

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

cs = sorted(Counter(S).values())
ct = sorted(Counter(T).values())

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

Verdicts: Wrong Answer

Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
S=input()
T=input()

Rs = {}
Rt = {}
for i in range(len(S)):
    if S[i] in Rs.keys:
        if Rs[S[i]] != T[i]:
             print("No")
             exit()
    else:
        Rs[S[i]] = T[i]

    if T[i] in Rt.keys:
        if Rt[T[i]] != S[i]:
            print("No")
            exit()
    else:
        Rt[T[i]] = S[i]
print("Yes")


S=input()
T=input()

Rs = {}
Rt = {}
for i in range(len(S)):
    if S[i] in Rs.keys():
        if Rs[S[i]] != T[i]:
             print("No")
             exit()
    else:
        Rs[S[i]] = T[i]

    if T[i] in Rt.keys():
        if Rt[T[i]] != S[i]:
            print("No")
            exit()
    else:
        Rt[T[i]] = S[i]
print("Yes")


Verdicts: Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
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)
d.sort(key=lambda x:x[0])
d2.sort(key=lambda x:x[0])
f=1
for i in range(26):
    if len(d[i])!=len(d2[i]):
        f=0
    else:
        for j in range(len(d[i])):
            if d[i]!=d2[i]:
                f=0
print(['No','Yes'][f])

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))])

Verdicts: Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
S=input()
T=input()
L=len(S)

dds=defaultdict(int)
ddt=defaultdict(int)

for i in range(L):
    s=S[i]
    t=T[i]
    if dds[s]==0:
        dds[s]=t
    else:
        if dds[s]!=t:
            print("No")
            exit()
    if ddt[t]==0:
        ddt[t]=s
    else:
        if ddt[t]!=s:
            print("No")
            exit()
print("Yes")

from collections import defaultdict

S=input()
T=input()
L=len(S)

dds=defaultdict(int)
ddt=defaultdict(int)

for i in range(L):
    s=S[i]
    t=T[i]
    if dds[s]==0:
        dds[s]=t
    else:
        if dds[s]!=t:
            print("No")
            exit()
    if ddt[t]==0:
        ddt[t]=s
    else:
        if ddt[t]!=s:
            print("No")
            exit()
print("Yes")

Verdicts: Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
S = input()
T = input()
for i in range(len(S)):
    kensa1 = [index for index, word in enumerate(S) if S[i] == word]
    kensa2 = [index for index, word in enumerate(S) if T[i] == word]
    if kensa1 != kensa2:
        print('No')
        break
else:
    print('Yes')

S = input()
T = input()
cnt = []
ans = 1
fis1 = [index for index, word in enumerate(S) if S[i] == S[0]]
fis2 = [index for index, word in enumerate(T) if T[i] == T[0]]

if fis1 != fis2:
    ans = 0
else:
    for i in range(len(S)):
        if i not in fis1:
            kensa1 = [index for index, word in enumerate(S) if S[i] == word]
            kensa2 = [index for index, word in enumerate(T) if T[i] == word]
            if kensa1 != kensa2:
                ans = 0
                break
            else:
                fis1.append(kensa1)
    
print('Yes' if ans == 1 else 'No')

import sys
from collections import defaultdict

S = input()
T = input()
L = len(S)

dcts = defaultdict(int)
dctt = defaultdict(int)
for i in range(L):
    s = S[i]
    t = T[i]
    if dcts[s] == 0:
        dcts[s] = t
    else:
        if dcts[s] != t:
            print('No')
            sys.exit()
    if dctt[t] == 0:
        dctt[t] = s
    else:
        if dctt[t] != s:
            print('No')
            sys.exit()
print('Yes')

Verdicts: Wrong Answer

Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
A = input()
B = input()

flag = True
if len(A) != len(B):
  flag = False 

pair_dict = dict()
reverse_dict = dict()
for i in range(len(A)):
  if A[i] not in pair_dict:
    pair_dict[A[i]] = B[i]
  elif pair_dict[A[i]] != B[i]:
    flag = False
    break
  if B[i] not in reverse_dict:
    reverse_dict[B[i]] = A[i]
  elif reverse_dict[B[i]] != A[i]:
    flag = False
    break
if flag:
  print("YES")
else:
  print("NO")


A = input()
B = input()

flag = True
if len(A) != len(B):
  flag = False 

pair_dict = dict()
reverse_dict = dict()
for i in range(len(A)):
  if A[i] not in pair_dict:
    pair_dict[A[i]] = B[i]
  elif pair_dict[A[i]] != B[i]:
    flag = False
    break
  if B[i] not in reverse_dict:
    reverse_dict[B[i]] = A[i]
  elif reverse_dict[B[i]] != A[i]:
    flag = False
    break
if flag:
  print("Yes")
else:
  print("No")


Verdicts: Wrong Answer

Accepted