Buggy python submission (verdict: Time Limit Exceeded):
S = list(str(input()))
T = list(str(input()))
check = 1
SC = [e for e in set(S) if S.count(e) > 1]
TC = [e for e in set(T) if T.count(e) > 1]
while len(S) > 0:
  if S[0] not in SC and T[0] not in TC:
    S.pop(0)
    T.pop(0)
  elif S[0]in SC and T[0] in TC:
    idxS = [j for j, x in enumerate(S) if x == S[0]]
    idxT = [j for j, x in enumerate(T) if x == T[0]]
    if idxS == idxT:
      for i in idxS[::-1]:
        S.pop(i)
        T.pop(i)
    else:
      check = 0
      break
  else:
    check = 0
    break
if check:
  print("Yes")
else:
  print("No")
  

Fixed submission:
S = list(str(input()))
T = list(str(input()))
check = 1
bij1 = {}
bij2 = {}
for i in range(len(S)):
  if S[i] in bij1 and bij1[S[i]] != T[i]:
    check = 0
    break
  elif T[i] in bij2 and bij2[T[i]] != S[i]:
    check = 0
    break
  elif S[i] not in bij1 and T[i] not in bij2:
    bij1[S[i]] = T[i]
    bij2[T[i]] = S[i]
    
if check:
  print("Yes")
else:
  print("No")

Buggy python submission (verdict: Time Limit Exceeded):
S = list(str(input()))
T = list(str(input()))
check = 1
while len(S) > 0:
  idxS = [j for j, x in enumerate(S) if x == S[0]]
  idxT = [j for j, x in enumerate(T) if x == T[0]]
  if idxS == idxT:
    for i in idxS[::-1]:
      S.pop(i)
      T.pop(i)
  else:
    check = 0
    break
if check:
  print("Yes")
else:
  print("No")
  

Fixed submission:
S = list(str(input()))
T = list(str(input()))
check = 1
bij1 = {}
bij2 = {}
for i in range(len(S)):
  if S[i] in bij1 and bij1[S[i]] != T[i]:
    check = 0
    break
  elif T[i] in bij2 and bij2[T[i]] != S[i]:
    check = 0
    break
  elif S[i] not in bij1 and T[i] not in bij2:
    bij1[S[i]] = T[i]
    bij2[T[i]] = S[i]
    
if check:
  print("Yes")
else:
  print("No")

Buggy python submission (verdict: Time Limit Exceeded):
S = list(str(input()))
T = list(str(input()))
check = 1
while len(S) > 0:
  idxS = [j for j, x in enumerate(S) if x == S[0]]
  idxT = [j for j, x in enumerate(T) if x == T[0]]
  if idxS == idxT:
    for i in idxS[::-1]:
      S.pop(i)
      T.pop(i)
  else:
    check = 0
    break
if check:
  print("Yes")
else:
  print("No")
  

Fixed submission:
S = list(str(input()))
T = list(str(input()))
check = 1
bij1 = {}
bij2 = {}
for i in range(len(S)):
  if S[i] in bij1 and bij1[S[i]] != T[i]:
    check = 0
    break
  elif T[i] in bij2 and bij2[T[i]] != S[i]:
    check = 0
    break
  elif S[i] not in bij1 and T[i] not in bij2:
    bij1[S[i]] = T[i]
    bij2[T[i]] = S[i]
    
if check:
  print("Yes")
else:
  print("No")

Buggy python submission (verdict: Time Limit Exceeded):
S = str(input())
T = str(input())
def check(S):
  done = []
  for i in range(len(S)):
    if i not in done:
      indexes = [j for j, x in enumerate(S) if x == S[i]]
      done.append(indexes)
  return done
if check(S) == check(T):
  print("Yes")
else:
  print("No")

Fixed submission:
S = list(str(input()))
T = list(str(input()))
check = 1
bij1 = {}
bij2 = {}
for i in range(len(S)):
  if S[i] in bij1 and bij1[S[i]] != T[i]:
    check = 0
    break
  elif T[i] in bij2 and bij2[T[i]] != S[i]:
    check = 0
    break
  elif S[i] not in bij1 and T[i] not in bij2:
    bij1[S[i]] = T[i]
    bij2[T[i]] = S[i]
    
if check:
  print("Yes")
else:
  print("No")