Buggy python submission (verdict: Time Limit Exceeded):
S = input()
T = input()
cnt = []
ans = 1
fis1 = [index for index, word in enumerate(S) if word == S[0]]
fis2 = [index for index, word in enumerate(T) if word == 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')

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

used = []
res  = []

for i in range(len(S)):
    if S[i] not in used:
        used.append(S[i])
    res.append(used.index(S[i]))

#print(used)
#print(res)
used = []
ret = []

for i in range(len(T)):
    if T[i] not in used:
        used.append(T[i])
    ret.append(used.index(T[i]))

if res == ret:
    print('Yes')
else:
    print('No')

Buggy python submission (verdict: Runtime Error):
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')

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

used = []
res  = []

for i in range(len(S)):
    if S[i] not in used:
        used.append(S[i])
    res.append(used.index(S[i]))

#print(used)
#print(res)
used = []
ret = []

for i in range(len(T)):
    if T[i] not in used:
        used.append(T[i])
    ret.append(used.index(T[i]))

if res == ret:
    print('Yes')
else:
    print('No')

Buggy python submission (verdict: Time Limit Exceeded):
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(T) if T[i] == word]

    if kensa1 != kensa2:
        print('No')
        break
else:
    print('Yes')

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

used = []
res  = []

for i in range(len(S)):
    if S[i] not in used:
        used.append(S[i])
    res.append(used.index(S[i]))

#print(used)
#print(res)
used = []
ret = []

for i in range(len(T)):
    if T[i] not in used:
        used.append(T[i])
    ret.append(used.index(T[i]))

if res == ret:
    print('Yes')
else:
    print('No')

Buggy python submission (verdict: Time Limit Exceeded):
S = input()
T = input()
for i in range(len(S)):
    if S[i] != T[i]:
        
        motoT = [j for j in range(len(S)) if S[j] == T[i]]
        
        migawari = S[i]
        
        
        S = S.replace(S[i], T[i])
        
        
        for k in motoT:
            S = list(S)
            S[k] = migawari
            S = ''.join(S)

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

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

used = []
res  = []

for i in range(len(S)):
    if S[i] not in used:
        used.append(S[i])
    res.append(used.index(S[i]))

#print(used)
#print(res)
used = []
ret = []

for i in range(len(T)):
    if T[i] not in used:
        used.append(T[i])
    ret.append(used.index(T[i]))

if res == ret:
    print('Yes')
else:
    print('No')

Buggy python submission (verdict: Time Limit Exceeded):
S = list(input())
T = list(input())

for i in range(len(S)):
    if S[i] != T[i]:
        migawari = S[i]
        index1 = [index for index, x in enumerate(S) if x == S[i]]
        index2 = [index for index, x in enumerate(S) if x == T[i]]
        for k in index1:
            S[k] = T[i]
        for j in index2:
            S[j] = migawari

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

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

used = []
res  = []

for i in range(len(S)):
    if S[i] not in used:
        used.append(S[i])
    res.append(used.index(S[i]))

#print(used)
#print(res)
used = []
ret = []

for i in range(len(T)):
    if T[i] not in used:
        used.append(T[i])
    ret.append(used.index(T[i]))

if res == ret:
    print('Yes')
else:
    print('No')