Buggy python submission (verdict: Time Limit Exceeded):
S=input()
T=input()
N=[i for i in range(len(S))]
visited=[]

for i in N:
    if (S[i] not in visited) and S[i]!=T[i]:
        visited.append(T[i])
        x=S[i]
        S=S.replace(T[i],'_')
        S=S.replace(S[i],T[i])
        S=S.replace('_',x)
    elif S[i] in visited and S[i]!=T[i]:
        break
    else:
        visited.append(T[i])
print('No') if S!=T else print('Yes')

Fixed submission:
S=input()
T=input()
R=[-1]*26
R2=[-1]*26
flag=1

for i in range(len(S)):
    a=ord(S[i])-97
    b=ord(T[i])-97
    if R[a]!=-1 or R2[b]!=-1:
        if R[a]!=b or R2[b]!=a:
            flag=0
            break
    else:
        R[a]=b
        R2[b]=a
if flag==0:
    print('No')
else:
    print('Yes')

Buggy python submission (verdict: Runtime Error):
S=input()
T=input()
N=[i in range(len(S))]
visited=[]

for i in N:
    if (S[i] not in visited) and S[i]!=T[i]:
        visited.append(T[i])
        x=S[i]
        S=S.replace(T[i],'_')
        S=S.replace(S[i],T[i])
        S=S.replace('_',x)
    elif S[i] in visited and S[i]!=T[i]:
        break
    else:
        visited.append(T[i])
print('No') if S!=T else print('Yes')

Fixed submission:
S=input()
T=input()
R=[-1]*26
R2=[-1]*26
flag=1

for i in range(len(S)):
    a=ord(S[i])-97
    b=ord(T[i])-97
    if R[a]!=-1 or R2[b]!=-1:
        if R[a]!=b or R2[b]!=a:
            flag=0
            break
    else:
        R[a]=b
        R2[b]=a
if flag==0:
    print('No')
else:
    print('Yes')

Buggy python submission (verdict: Time Limit Exceeded):
S=input()
T=input()
visited=[]

for i in range(len(S)):
    if (S[i] not in visited) and S[i]!=T[i]:
        visited.append(T[i])
        x=S[i]
        S=S.replace(T[i],'_')
        S=S.replace(S[i],T[i])
        S=S.replace('_',x)
    elif S[i] in visited and S[i]!=T[i]:
        break
    else:
        visited.append(T[i])
print('No') if S!=T else print('Yes')

Fixed submission:
S=input()
T=input()
R=[-1]*26
R2=[-1]*26
flag=1

for i in range(len(S)):
    a=ord(S[i])-97
    b=ord(T[i])-97
    if R[a]!=-1 or R2[b]!=-1:
        if R[a]!=b or R2[b]!=a:
            flag=0
            break
    else:
        R[a]=b
        R2[b]=a
if flag==0:
    print('No')
else:
    print('Yes')

Buggy python submission (verdict: Time Limit Exceeded):
S=input()
T=input()
visited=[]

for i in range(len(S)):
    if (S[i] not in visited) and S[i]!=T[i]:
        visited.append(T[i])
        x=S[i]
        S=S.replace(T[i],'_')
        S=S.replace(S[i],T[i])
        S=S.replace('_',x)
    elif (S[i] in visited) and S[i]!=T[i]:
        break
    else:
        visited.append(T[i])
print('No') if S!=T else print('Yes')

Fixed submission:
S=input()
T=input()
R=[-1]*26
R2=[-1]*26
flag=1

for i in range(len(S)):
    a=ord(S[i])-97
    b=ord(T[i])-97
    if R[a]!=-1 or R2[b]!=-1:
        if R[a]!=b or R2[b]!=a:
            flag=0
            break
    else:
        R[a]=b
        R2[b]=a
if flag==0:
    print('No')
else:
    print('Yes')

Buggy python submission (verdict: Runtime Error):
S=input()
T=input()
visited=[]

for i in range(len(S)):
    if (S[i] not in visited) and S[i]!=T[i]:
        visited.append(T[i])
        x=S[i]
        S=S.replace(T[i],'_')
        S=S.replace(S[i],T[i])
        S=S.replace('_',x)
    elif (S[i] in visited) and S[i]!=T[i]:
        break
    else:
        visited.append(T[i])
    print(S)
print('No') if S!=T else print('Yes')

Fixed submission:
S=input()
T=input()
R=[-1]*26
R2=[-1]*26
flag=1

for i in range(len(S)):
    a=ord(S[i])-97
    b=ord(T[i])-97
    if R[a]!=-1 or R2[b]!=-1:
        if R[a]!=b or R2[b]!=a:
            flag=0
            break
    else:
        R[a]=b
        R2[b]=a
if flag==0:
    print('No')
else:
    print('Yes')