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):
def main(S, T):
    cs = dict()

    for i, s in enumerate(S):
        t = T[i]
        if s != t:
            if t not in cs:
                cs[t] = s
            elif cs[t] == s:
                continue
            else:
                return "No"
    return "Yes"

if __name__ == "__main__":
    
    
    
    S = input()
    T = input()
    print(main())


def main(S, T):
    cs = dict()

    for i, s in enumerate(S):
        t = T[i]
        if s != t:
            if t not in cs:
                cs[t] = s
            elif cs[t] == s:
                continue
            else:
                return "No"
    return "Yes"

if __name__ == "__main__":

    S = input()
    T = input()
    print(main())


def main():
    S = input()
    T = input()
    cs = dict()
    to = set()
    for i, s in enumerate(S):
        t = T[i]
        if s != t:
            if s not in cs:
                if t in to:
                    print("NO")
                    return
                to.add(t)
                cs[s] = t
            elif cs[s] == t:
                continue
            else:
                print("NO")
                return
    print("YES")


if __name__ == "__main__":
    main()


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


Verdicts: Runtime Error

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

# chokudai
# redkuoai



# iaucoder

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

from collections import defaultdict
s_dic = defaultdict(set)
t_dic = defaultdict(set)
for i in range(len(S)):
    s = S[i]
    t = T[i]
    if len(s_dic[s]) > 0 and t not in s_dic[s]:
        print(False)
        exit()
    if len(t_dic[t]) > 0 and s not in t_dic[t]:
        print(False)
        exit()
    s_dic[s].add(t)
    t_dic[t].add(s)

print(True)



# chokudai
# redkuoai



# iaucoder

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

from collections import defaultdict
s_dic = defaultdict(set)
t_dic = defaultdict(set)
for i in range(len(S)):
    s = S[i]
    t = T[i]
    if len(s_dic[s]) > 0 and t not in s_dic[s]:
        print('No')
        exit()
    if len(t_dic[t]) > 0 and s not in t_dic[t]:
        print('No')
        exit()
    s_dic[s].add(t)
    t_dic[t].add(s)

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

alphabet_list = [[]for i in range(26)]

for i in range(len(s)):
    if s[i] == t[i]:
        continue
    if t[i] not in alphabet_list[ord(s[i])-97]:
        alphabet_list[ord(s[i])-97].append(t[i])
    elif t[i] in alphabet_list[ord(s[i])-97]:
        continue
    else:
        print('No')
        exit()

for i in range(25):
    for j in range(i, 26):
        if alphabet_list[i] == alphabet_list[j]:
            print('No')
            exit()

print('Yes')


s = input()
t = input()

alphabet_1 = [[] for _ in range(26)]
alphabet_2 = [[] for _ in range(26)]

for i in range(len(s)):
    if alphabet_1[ord(s[i])-97] == []:
        alphabet_1[ord(s[i])-97] = t[i]
    else:
        if alphabet_1[ord(s[i])-97] == t[i]:
            continue
        else:
            print('No')
            exit()

    if alphabet_2[ord(t[i])-97] == []:
        alphabet_2[ord(t[i])-97] = s[i]
    else:
        if alphabet_2[ord(t[i])-97] == s[i]:
            continue
        else:
            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):
s = input()
t = input()

s2 = []
t2 = []

sdic = {}
tdic = {}

cnt = 0
for c in s:
    if c in sdic:
        s2.append(sdic[c])
    else:
        s2.append(cnt)
        sdic[c] = cnt
        cnt += 1

cnt = 0
for c in t:
    if c in tdic:
        t2.append(tdic[c])
    else:
        t2.append(cnt)
        tdic[c] = cnt
        cnt += 1
        
print(s2)
print(t2)

print("Yes" if s2 == t2 else "No")


s = input()
t = input()

s2 = []
t2 = []

sdic = {}
tdic = {}

cnt = 0
for c in s:
    if c in sdic:
        s2.append(sdic[c])
    else:
        s2.append(cnt)
        sdic[c] = cnt
        cnt += 1

cnt = 0
for c in t:
    if c in tdic:
        t2.append(tdic[c])
    else:
        t2.append(cnt)
        tdic[c] = cnt
        cnt += 1

print("Yes" if s2 == t2 else "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):
print(["No", "Yes"][Counter(Counter(input()).values()) == Counter(Counter(input()).values())])

from bisect import bisect, bisect_left
from collections import Counter, defaultdict
from functools import reduce
from itertools import accumulate
from operator import itemgetter, xor, mul

import sys
#input = sys.stdin.readline

def inpl(): return list(map(int, input().split()))
S = input()
T = input()
P = defaultdict(set)

for i in range(len(S)):
    P[S[i]].add(T[i])
    

for v in P.values():
    if len(v) >= 2:
        print("No")
        break
else:
    if Counter(Counter(S).values()) == Counter(Counter(T).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):
from collections import defaultdict
S, T = map(lambda x: x.strip(), open(0).read().split())

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

from collections import defaultdict
S, T = map(lambda x: x.strip(), open(0).read().split())

from collections import defaultdict
S, T = map(lambda x: x.strip(), open(0).read().split())

ds, dt = defaultdict(str), defaultdict(str)
ans = 'Yes'
for s, t in zip(S, T):
    if not ds[s] or ds[s] == t:
        ds[s] = t
    else:
        ans = 'No'
        break
    if not dt[t] or dt[t] == s:
        dt[t] = s
    else:
        ans = 'No'
        break
print(ans)

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

ds = {}
dt = {}
ans = 'Yes'
for s, t in zip(S, T):
    if s not in ds or ds[s] == t:
        ds[s] = t
    else:
        ans = 'No'
        break
    if t not in dt or dt[s] == s:
        dt[t] = s
    else:
        ans = 'No'
        break
print(ans)

S, T = input().strip(), input().strip()
ds, dt = {}, {}

for s, t in zip(S, T):
    if s not in ds or ds[s] == t:
        ds[s] = t
    else:
        print('No')
        exit()
    if t not in dt or dt[t] == s:
        dt[t] = s
    else:
        print('No')
        exit()
print('Yes')

Verdicts: Wrong Answer

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

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

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

def get_input(inp):
    li = inp.split("\n")

    def inner():
        return li.pop(0)
    return inner

INPUT = 
input = get_input(INPUT)

#######################################################
a = input()
b = input()
k = []
l = []
np=0
nq=0
for i in range(0,len(a)):
    if a[i] not in k:
        k.append(a[i])
        np+=1
    if b[i] not in l:
        l.append(b[i])
        nq+=1
    if i != 0:
        if not (k.index(a[i])==l.index(b[i]) and ((a[i-1]==a[i] and b[i-1] == b[i]) or ( a[i-1] != a[i] and b[i-1]!= b[i]))):
            np*=0
if np == nq:
    print("Yes")
else:
    print("No")

a = input()
b = input()
k = []
l = []
np=0
nq=0
for i in range(0,len(a)):
    if a[i] not in k:
        k.append(a[i])
        np+=1
    if b[i] not in l:
        l.append(b[i])
        nq+=1
    if i != 0:
        if not (k.index(a[i])==l.index(b[i]) and ((a[i-1]==a[i] and b[i-1] == b[i]) or ( a[i-1] != a[i] and b[i-1]!= b[i]))):
            np*=0
if np == nq:
    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()

sc = ["" for i in range(0, 26)]
tc = ["" for i in range(0, 26)]
scf = False
tcf = False
for i in range(0, len(s)):
    sci = sc[ord(s[i]) - ord('a')]
    if sci != "" and t[i] != sci:
        print("NO")
        scf = True
        break
    else:
        sc[ord(s[i]) - ord('a')] = t[i]

if not scf:
    for i in range(0, len(t)):
        tci = tc[ord(t[i]) - ord('a')]
        if tci != "":
            if t[i] == tci or t[i] == s[i]:
                print("NO")
                tcf = True
                break
        else:
            tc[ord(t[i]) - ord('a')] = s[i]

    if not tcf:
        print("YES")

s = input()
t = input()

sc = ["" for i in range(0, 26)]
tc = ["" for i in range(0, 26)]
scf = False
tcf = False
for i in range(0, len(s)):
    sci = sc[ord(s[i]) - ord('a')]
    if sci != "" and t[i] != sci:
        print("No")
        scf = True
        break
    else:
        sc[ord(s[i]) - ord('a')] = t[i]

if not scf:
    for i in range(0, len(t)):
        tci = tc[ord(t[i]) - ord('a')]
        if tci != "" and s[i] != tci:
            print("No")
            tcf = True
            break
        else:
            tc[ord(t[i]) - ord('a')] = s[i]
    if not tcf:
        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()


if set(list(s)) != set(list(t)):
    print("No")
    exit()


d = dict()
for si, ti in zip(s, t):
    if si not in d:
        d[si] = ti
    else:
        if d[si] != ti:
            print("No")
            exit()
print("Yes")

s = input()
t = input()


if len(set(list(s))) != len(set(list(t))):
    print("No")
    exit()


d = dict()
for si, ti in zip(s, t):
    if si not in d:
        d[si] = ti
    else:
        if d[si] != ti:
            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):
a = list(input())
b = list(input())
c = len(a)
p = 0
d = [0 for i in range(27)]
l = [[]for i in range(27)]
h = [[]for i in range(27)]
ll = [0 for i in range(27)]
if a == b:
	print("Yes")
else:
	for i in range(c):
		k = ord(b[i])-97
		if a[i] in l[k]:
			p = 0
		else:
			if len(l[k]) == 0:
				l[k].append(a[i])
			else:
				p = 1
				break
		k = ord(a[i])-97
		if b[i] in h[k]:
			p = 0
		else:
			if len(h[k]) == 0:
				h[k].append(a[i])
			else:
				p = 1
				break
	if p == 1:
		print("No")
	else:
		print("Yes")


a = list(input())
b = list(input())
c = len(a)
p = 0
d = [0 for i in range(27)]
l = [[]for i in range(27)]
h = [[]for i in range(27)]
ll = [0 for i in range(27)]
if a == b:
	print("Yes")
else:
	for i in range(c):
		k = ord(b[i])-97
		if a[i] in l[k]:
			p = 0
		else:
			if len(l[k]) == 0:
				l[k].append(a[i])
			else:
				p = 1
				break
		k = ord(a[i])-97
		if b[i] in h[k]:
			p = 0
		else:
			if len(h[k]) == 0:
				h[k].append(b[i])
			else:
				p = 1
				break
	if p == 1:
		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):
import collections
S=input()
T=input()
tableS=collections.defaultdict(list)
tableT=collections.defaultdict(list)

for i in range(len(S)):
  tableS[S[i]].append(i)
  tableT[T[i]].append(i)
listS=tableS.values()
listT=tableT.values()
for x in listS:
  flag=False
  for y in listT:
    if x in y:
      flag=True
      break
  if not flag:
    print("No")
    exit(0)
print("Yes")
      

def main():
    import collections
    S = input()
    T = input()
    N = len(S)
    table = collections.defaultdict(int)
    table2 = collections.defaultdict(int)
    flag = True
    for i in range(N):
        x = S[i]
        y = T[i]

        if x in table:
            if y == T[table[x]]:
                continue
            else:
                flag = False
                break
        else:
            if y in table2:
                flag = False
                break
            table[x] = i
            table2[y] = i

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


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):
s = list(input())
t = list(input())

print(s)
print(t)

sset = list(set(s))
tset = list(set(t))

print(sset)
print(tset)

s_getindex = []
t_getindex = []

for j in range(len(sset)):
    s_getindex.append([i for i, x in enumerate(s) if x == sset[j]])

for jj in range(len(tset)):
    t_getindex.append([ii for ii, y in enumerate(t) if y == tset[jj]])

print(s_getindex)
print(t_getindex)

check_s = []
check_t = []
ans = 0

for k in range(len(sset)):
    if len(s_getindex[k]) != 1:
        for m in s_getindex[k]:
            check_s.append(t[m])
        if len(set(check_s)) != 1:
            ans = ans + 1

for kk in range(len(tset)):
    if len(t_getindex[kk]) != 1:
        for mm in t_getindex[kk]:
            check_t.append(s[mm])
        if len(set(check_t)) != 1:
            ans = ans + 1

print(ans)

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


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

#print(s)
#print(t)

sset = list(set(s))
tset = list(set(t))

#print(sset)
#print(tset)

s_getindex = []
t_getindex = []

for j in range(len(sset)):
    s_getindex.append([i for i, x in enumerate(s) if x == sset[j]])

for jj in range(len(tset)):
    t_getindex.append([ii for ii, y in enumerate(t) if y == tset[jj]])

#print(s_getindex)
#print(t_getindex)

check_s = []
check_t = []
ans = 0

for k in range(len(sset)):
    if len(s_getindex[k]) != 1:
        for m in s_getindex[k]:
            check_s.append(t[m])
#        print(check_s)
#        print(len(set(check_s)))
        if len(set(check_s)) != 1:
            ans = ans + 1
#            print(s[m])
        check_s.clear()

for kk in range(len(tset)):
    if len(t_getindex[kk]) != 1:
        for mm in t_getindex[kk]:
            check_t.append(s[mm])
        if len(set(check_t)) != 1:
            ans = ans + 1
#            print(t[mm])
        check_t.clear()

#print(ans)

if ans == 0:
    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):
#! /usr/bin/env python
# -*- coding: utf-8 -*-

#

"""
RC110C
"""


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

def exchange(a,b,c):
    if a != b and a!=c:
        return(a)
    elif a == b:
        return(c)
    elif a == c:
        return(b)

ans = 'Yes'

seen = set()
for i in range(n):
    sl = s.pop()
    tl = t.pop()
    if sl == tl:
        seen.add(sl)
    elif sl != tl and not tl in seen and not sl in seen:
        s = list(map(lambda a: exchange(a,sl,tl),s))
        seen.add(tl)
    else:
        ans = 'No'
        break
    print(s)

print(ans)





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

#

"""
RC110C
"""


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

def exchange(a,b,c):
    if a != b and a!=c:
        return(a)
    elif a == b:
        return(c)
    elif a == c:
        return(b)

ans = 'Yes'

seen = set()
for i in range(n):
    sl = s.pop()
    tl = t.pop()
    if sl == tl:
        seen.add(sl)
    elif sl != tl and not tl in seen and not sl in seen:
        s = list(map(lambda a: exchange(a,sl,tl),s))
        seen.add(tl)
    else:
        ans = 'No'
        break

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


s = list(input())
t = list(input())
s.sort()
t.sort()
if s == t:
    print("Yes")
else:
    print("No")


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)


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 = list(str(input()))
t = list(str(input()))



def judge(S,T):
    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")
                break
        else:
            start[a] = b
            goal[b] =a
        if i==len(S)-1:
            print("Yes")
            
            
 judge(s,t)           

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

def judge(S,T):
    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")
                break
        else:
            start[a] = b
            goal[b] =a
        if i==len(S)-1:
            print("Yes")
            
judge(s,t)

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

S_dic={}
T_dic={}

for i in range(len(S)):

    if S[i] in S_dic:
        S_dic[S[i]].append(i)
    else:
        S_dic[S[i]] = [i]

for i in range(len(T)):

    if T[i] in T_dic:
        T_dic[T[i]].append(i)
    else:
        T_dic[T[i]] = [i]


print (S_dic)
print (T_dic)

T_dicR = {}

for i in T_dic:
    T_dicR[ str(T_dic[i]) ] = 1

ans = True

for i in S_dic:

    if str(S_dic[i]) not in T_dicR:
        ans = False
        break

print (T_dicR)

if ans:
    print ("Yes")

else:
    print ("No")


S = input()
T = input()

S_dic={}
T_dic={}

for i in range(len(S)):

    if S[i] in S_dic:
        S_dic[S[i]].append(i)
    else:
        S_dic[S[i]] = [i]

for i in range(len(T)):

    if T[i] in T_dic:
        T_dic[T[i]].append(i)
    else:
        T_dic[T[i]] = [i]


#print (S_dic)
#print (T_dic)

T_dicR = {}

for i in T_dic:
    T_dicR[ str(T_dic[i]) ] = 1

ans = True

for i in S_dic:

    if str(S_dic[i]) not in T_dicR:
        ans = False
        break

#print (T_dicR)

if ans:
    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):
print(['No','Yes'][sorted(input())==sorted(input())])

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

for _ in range(2):

    n = len(s)
    l = [set() for _ in range(26)]

    def f(c):
        return ord(c) - ord('a')

    for i, j in enumerate(s):
        l[f(j)].add(t[i])

    for i in l:
        if len(list(i)) > 1:
            print('No')
            exit(0)
        
    s,t = t,s

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 = sorted(Counter(input()).values)
t = sorted(Counter(input()).values)
print("Yes" if s==t else "No")

from collections import Counter
s = sorted(Counter(list(input())).values())
t = sorted(Counter(list(input())).values())
print("Yes" if s==t else "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 collections
S=input()
T=input()
a1=collections.Counter(S)
a2=collections.Counter(T)
if a1==a2:
    print('Yes')
else:
    print('No')

import collections
S=input()
T=input()
a1=collections.Counter(S)
a2=collections.Counter(T)
x=''
for i in range(len(S)):
    if a1[S[i]]!=a2[T[i]]:
        x='No'
if x=='':
    print('Yes')
else:
    print(x)

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=input()
T=input()

S=Counter(S).values()
T=Counter(T).values()

S.sort()
T.sort()

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


from collections import Counter

S=input()
T=input()

S=list(Counter(S).values())
T=list(Counter(T).values())

S.sort()
T.sort()

if S==T:
  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()

for w in list(S):
    if w in list(T):
        S = list(S)
        T = list(T)
        idx = S.index(w)
        del S[idx]
        del T[idx]
        S = ''.join(S)
        T = ''.join(T)
s_count = Counter(S)
del_s = []
t_count = Counter(T)
del_t = []

for ks, vs in list(s_count.items()):
    for kt, vt in list(t_count.items()):
        if vs == vt:
            del_s.append(ks)
            del_t.append(kt)
            del s_count[ks]
            del t_count[kt]
            break

if len(S) == len(del_s):
    print('Yes')
else:
    print('No')


from collections import defaultdict
S = list(input())
T = list(input())
l = len(S)
ds = defaultdict(str)
dt = defaultdict(str)
for i in range(l):
    if ds[S[i]] == "":
        ds[S[i]] = T[i]
    elif ds[S[i]] == T[i]:
        pass
    else:
        print('No')
        exit()
    if dt[T[i]] == "":
        dt[T[i]] = S[i]
    elif dt[T[i]] == S[i]:
        pass
    else:
        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 collections

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

cs = collections.Counter(s)
ct = collections.Counter(t)

slist = cs.values()
tlist = ct.values()

slist.sort()
tlist.sort()

if slist == tlist:
    print("Yes")
else:
    print("No")



from collections import Counter

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

cs = Counter(s)
ct = Counter(t)

slist = cs.value()
tlist = cs.value()

slist.sort()
tlist.sort()

if slist == tlist:
    print("Yes")
else:
    print("No")

from collections import Counter

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

cs = Counter(s)
ct = Counter(t)

slist = list(cs.value())
tlist = list(cs.value())

slist.sort()
tlist.sort()

if slist == tlist:
    print("Yes")
else:
    print("No")


import collections

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

cs = collections.Counter(s)
ct = collections.Counter(t)

slist = list(cs.values())
tlist = list(ct.values())

slist.sort()
tlist.sort()

if slist == tlist:
    print("Yes")
else:
    print("No")



Verdicts: Runtime Error

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):
import collections
s = input()
t = input()

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

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

s = list(input().split())
t = list(input().split())

n = len(s)
x = [0]*n
for i in range(n-1):
    if s[i] == s[i+1]: 
        x[i] += 1
    else:
        break

y = [0]*n
for i in range(n-1):
    if s[i] == s[i+1]: 
        x[i] += 1
    else:
        break

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

S1 = S.values()
T1 = S.values()

if x == y and sorted(S1) == sorted(T1):
    print('Yes')
else:
    print('No')

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

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=input()
t=input()
S=[]
T=[]
for i in s:
    S.append(s.count(i)) 
for j in t:
    T.append(t.count(j))
if S==T:
    print('YES')
else:print('NO')

s=input()
t=input()
S=[]
T=[]
for i in s:
    S.append(s.count(i)) 
for j in t:
    T.append(t.count(j))
print(S,T)
if S==T:
    print('Yes')
else:print('No')

s=input()
t=input()
S=[0 for i in range(26)]
T=[0 for i in range(26)]
for i in range(len(s)):
    S[ord(s[i])-97]=int(str(S[ord(s[i])-97])+str(i))  
for i in range(len(t)):
    T[ord(t[i])-97]=int(str(T[ord(t[i])-97])+str(i))  
ss=sorted(S)
tt=sorted(T)
print(S,T,ss,tt)
if ss==tt:
    print('Yes')
else:print('No')


S=input()
T=input()

d={}

for i in range(len(S)):
    if S[i] not in d:
        d[S[i]]=T[i] 
    else:
      
        if d[S[i]]!=T[i]:
            print('No')
            exit()
d={}
for i in range(len(T)):
    if T[i] not in d:
        d[T[i]]=S[i]
    else:
        if d[T[i]]!=S[i]:
            print('No')
            exit()
print('Yes')

Verdicts: Wrong Answer

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()
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"
if s!=n and len(s)=26:
  ans="No"
print(ans)

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"
a=set()
for i in s:
  a.add(i)
b=set()
for i in n:
  b.add(i)
if a!=b:
  ans="No"
print(ans)

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)

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):
from collections import Counter

s = input()
t = input()

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

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

def solve(s, t):
    dic1, dic2 = {}, {}
    for x, y in zip(s, t):
        if x in dic1:
            if dic1[x] != y:
                return False
        else:
            dic1[x] = y
        if y in dic2:
            if dic2[y] != x:
                return False
        else:
            dic2[y] = x
    return True


s = input()
t = input()

print('Yes' if solve(s, t) else '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()
alphs = "abcdefghijklmnopqrstuvwxyz"
flag = False
for alph in alphs:
    S2 = S
    indlist = []
    while alph in S2:
        i = S.index(alph)
        indlist.append(i)
        S2 = S2[i+1:]
    if indlist != []:
        T2 = T[indlist[0]]
    for ind in indlist:
        if T[ind] != T2:
            print("No")
            flag = True
            break
    if flag:
        break
else:
    for alph in alphs:
        T3 = T
        indlist = []
        while alph in T3:
            i = T.index(alph)
            indlist.append(i)
            T3 = T3[i+1:]
        if indlist != []:
            S3 = S[indlist[0]]
        for ind in indlist:
            if S[ind] != T3:
                print("No")
                flag = True
                break
        if flag:
            break
    else:
        print("Yes")


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


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

a = [chr(i + ord("a")) for i in range(26)]
b = []

for i in range(len(s)):
    if s[i] != t[i]:
        c1 = s[i]
        c2 = t[i]
        if c2 not in a:
            for j in range(len(b)):
                if b[j][1] == c2 and b[j][0] != c1:
                    print("No")
                    exit()
        a.remove(c2)
        b.append([c1, c2])
else:
    print("Yes")

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

b = []

for i in range(len(s)):
    c1 = s[i]
    c2 = t[i]
    if c1 == c2:
        if b[j][0] == c1:
            print("No")
            exit()
    if c1 != c2:
        for j in range(len(b)):
            if b[j][0] == c1 and b[j][1] != c2:
                print("No")
                exit()
            if b[j][0] != c1 and b[j][1] == c2:
                print("No")
                exit()
            if b[j][0] == c1 and b[j][1] == c2:
                break
        b.append([c1, c2])
else:
    print("Yes")


S = input()
T = input()

converter = dict()

for s, t in zip(S, T):
    if converter.get(s) is not None:
        if converter[s] != t:
            print("No")
            break
    else:
        converter[s] = t
else:
    if len(converter.values()) != len(set(converter.values())):
        print("No")
    else:
        print("Yes")

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

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)

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 main():
    
    S = input()
    T = input()

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


if True:
    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):
    
    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()


def main():
    
    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):
    
    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()


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):
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]]
    print(aR)
    return aR



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





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


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 = sorted(input())
T = sorted(input())
cnt = 0
for i in range(len(S)):
  if(S[i] != T[i]):
    cnt += 1
if(cnt <= 1):
  print('Yes')
else:
  print('No')

S = list(set(sorted(input())))
T = list(set(sorted(input())))
if(len(S) != len(T)):
  print('No')
  exit()
cnt = 0
for i in range(len(S)):
  if(S[i] != T[i]):
    cnt += 1
if(cnt <= 1):
  print('Yes')
else:
  print('No')

import sys 
stdin = sys.stdin
ns = lambda : stdin.readline().rstrip()

s = ns()
t = ns()
s_cnt = []
t_cnt = []
for alp in "abcdefghijklmnopqrstuvwxyz":
  s_cnt.append(s.count(alp))
  t_cnt.append(t.count(alp))
s_cnt.sort()
t_cnt.sort()
if s_cnt == t_cnt:
  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):
import collections
s = input()
t = input()

cs = collections.Counter(s)
ct = collections.Counter(t)

# print(list(cs.values()),list(ct.values()))
if(list(cs.values())==list(ct.values())):
    print("YES")
else:
    print("NO")

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

d = {}
flag = True
for i in range(len(s)):
    if s[i] in d.keys():
        if t[i] == d[s[i]]:
            continue
        else:
            flag=False
            break
    elif t[i] in d.values():
        if d.get(s[i]) == t[i]:
            continue
        else:
            flag=False
            break
    else:
        d[s[i]] = t[i]

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

Verdicts: Wrong Answer

Accepted