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):
one=list(input())
#print(one)
two=list(input())
z={}
for num,i in enumerate(one):
    if i not in z:
        z[i]=[num]
    else:
        z[i].append(num)
p={}
for num,i in enumerate(two):
    if i not in p:
        p[i]=[num]
    else:
        p[i].append(num)
w=[]
print(p)
print(z)
for k,v in z.items():
    w.append(v)
o=[]
for k,v in p.items():
    o.append(v)
print("Yes") if w==o else print("No")

import sys
from collections import Counter
one=list(input())
print(one)
two=list(input())
if len(one)!=len(two):
    print("No")
    sys.exit()
three=Counter(one)
print(one)
four=Counter(two)
print(two)
if len(three)!=len(four):
    print("No")
    sys.exit()
print("Yes")

one=list(input())
#print(one)
two=list(input())

for num,i in enumerate(one):
    if i not in z:
        z[i]=[num]
    else:
        z[i].append(num)
p={}
for num,i in enumerate(two):
    if i not in p:
        p[i]=[num]
    else:
        p[i].append(num)
w=[]
#print(p)
#print(z)
for k,v in z.items():
    w.append(v)
o=[]
for k,v in p.items():
    o.append(v)
print("Yes") if w==o else print("No")

import sys
from collections import Counter
one=list(input())
#print(one)
two=list(input())
z={}
result=[]
for num,i in enumerate(one):
    if i not in z:
        z[i]=[num]
    else:
        z[i].append(num)
p={}
for num,i in enumerate(two):
    if i not in p:
        p[i]=[num]
    else:
        p[i].append(num)

print(p)
print(z)

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

one=list(input())
#print(one)
two=list(input())
if one==[] or two==[]
z={}
for num,i in enumerate(one):
    if i not in z:
        z[i]=[num]
    else:
        z[i].append(num)
p={}
for num,i in enumerate(two):
    if i not in p:
        p[i]=[num]
    else:
        p[i].append(num)
w=[]
#print(p)
#print(z)
for k,v in z.items():
    w.append(v)
o=[]
for k,v in p.items():
    o.append(v)
print("Yes") if w==o else print("No")

one=list(input())
#print(one)
two=list(input())
z={}
for num,i in enumerate(one):
    if i not in z:
        z[i]=[num]
    else:
        z[i].append(num)
p={}
for num,i in enumerate(two):
    if i not in p:
        p[i]=[num]
    else:
        p[i].append(num)
w=[]
print(p)
print(z)
for k,v in z.items():
    if len(v)>1:
        w.append(v)
o=[]
for k,v in p.items():
    if len(v)>1:
        o.append(v)
#print(w)
#print(o)


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

import sys
from collections import Counter
one=list(input())
#print(one)
two=list(input())
z={}
result=[]
for num,i in enumerate(one):
    if i not in z:
        z[i]=[num]
    else:
        z[i].append(num)
p={}
for num,i in enumerate(two):
    if i not in p:
        p[i]=[num]
    else:
        p[i].append(num)

#print(p)
#print(z)

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


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



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

Verdicts: Wrong Answer

Wrong Answer

Runtime Error

Wrong Answer

Runtime Error

Wrong Answer

Accepted