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

ans = True 

while S != []:
    lis = []
    lit = []
    x = S[0]
    y = T[0]
    for i in range(len(S)):
        if x == S[i]:
            lis.append(i)
        if y == T[i]:
            lit.append(i)
    if lis == lit:
        S = [S[i] for i in range(len(S)) if i not in lis]
        T = [T[i] for i in range(len(T)) if i not in lis]
        continue
    else:
        ans = False
        break
if ans:
    print('Yes')
if not ans:
    print('No')

Fixed submission:
Sp = list(input())
Tp = list(input())
S = [ord(Sp[i])-ord('a') for i in range(len(Sp))]
T = [ord(Tp[i])-ord('a') for i in range(len(Tp))]
lis = [-1]*26
lit = [-1]*26
ans = True
for i in range(len(S)):
    if lis[S[i]] == -1:
        lis[S[i]] = T[i]
    else:
        if lis[S[i]] != T[i]:
            ans = False
            break
for i in range(len(T)):    
    if lit[T[i]] == -1:
        lit[T[i]] = S[i]
    else:
        if lit[T[i]] != S[i]:
            ans = False
            break
if ans:
    print('Yes')
else:
    print('No')

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

ans = True 

while S != []:
    lis = []
    lit = []
    x = S[0]
    y = T[0]
    for i in range(len(S)):
        if x == S[i]:
            lis.append(i)
        if y == T[i]:
            lit.append(i)
    if lis == lit:
        while x in S:
            S.remove(x)
        while y in T:
            T.remove(y)
        continue
    else:
        ans = False
        break
if ans:
    print('Yes')
if not ans:
    print('No')

Fixed submission:
Sp = list(input())
Tp = list(input())
S = [ord(Sp[i])-ord('a') for i in range(len(Sp))]
T = [ord(Tp[i])-ord('a') for i in range(len(Tp))]
lis = [-1]*26
lit = [-1]*26
ans = True
for i in range(len(S)):
    if lis[S[i]] == -1:
        lis[S[i]] = T[i]
    else:
        if lis[S[i]] != T[i]:
            ans = False
            break
for i in range(len(T)):    
    if lit[T[i]] == -1:
        lit[T[i]] = S[i]
    else:
        if lit[T[i]] != S[i]:
            ans = False
            break
if ans:
    print('Yes')
else:
    print('No')

Buggy python submission (verdict: Time Limit Exceeded):
S = input()
T = input()
ans = True
for i in range(len(S)):
    li =  []
    for j in range(len(S)):
        if S[j] == S[i]:
            li.append(j)
    for j in li:
        if T[li[0]] != T[j]:
            ans = False

for i in range(len(T)):
    li =  []
    for j in range(len(T)):
        if T[j] == T[i]:
            li.append(j)
    for j in li:
        if S[li[0]] != S[j]:
            ans = False
if ans:
    print('Yes')
else:
    print('No')

Fixed submission:
Sp = list(input())
Tp = list(input())
S = [ord(Sp[i])-ord('a') for i in range(len(Sp))]
T = [ord(Tp[i])-ord('a') for i in range(len(Tp))]
lis = [-1]*26
lit = [-1]*26
ans = True
for i in range(len(S)):
    if lis[S[i]] == -1:
        lis[S[i]] = T[i]
    else:
        if lis[S[i]] != T[i]:
            ans = False
            break
for i in range(len(T)):    
    if lit[T[i]] == -1:
        lit[T[i]] = S[i]
    else:
        if lit[T[i]] != S[i]:
            ans = False
            break
if ans:
    print('Yes')
else:
    print('No')