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):
s = input()
t = input()

sset = set(s)
tset = set(t)
slist = list()
tlist = list()

if len(sset) != len(tset):
   print("No")
else:
   for i in range(len(s)):
      smoji = s[i]
      if s[i] in slist:
         continue
      else:
         s.replace(s[i], i)
   for i in range(len(t)):
      tmoji = t[i]
      if t[i] in tlist:
         continue
      else:
         t.replace(t[i], i)
   if s != t:
      print("No")
   else:
      print("Yes")



s = input()
t = input()

sset = set(s)
tset = set(t)
slist = list()
tlist = list()

if len(sset) != len(tset):
   print("No")
else:
   for i in range(len(s)):
      smoji = s[i]
      if s[i] in slist:
         continue
      else:
         si = string(i)
         s.replace(s[i], si)
   for i in range(len(t)):
      tmoji = t[i]
      if t[i] in tlist:
         continue
      else:
         ti = string(i)
         t.replace(t[i], ti)
   if s != t:
      print("No")
   else:
      print("Yes")



S = input()
T = input()

i = 0
j = 0
ss = list()
tt = list()
slist = list()
tlist = list()

if len(S) == len(T):
   for s in S:
      if s in slist:
         ss.append(slist[s])
      else:
         ss.append(i)
         slist.append(s)
         i += 1

   for t in T:
      if t in tlist:
         tt.append(tlist[t])
      else:
         tt.append(j)
         tlist.append(t)
         j += 1

   if ss == tt:
      print("Yes")
   else:
      print("No")
else:
   print("No")
      
      
         


s = input()
t = input()

sset = set(s)
tset = set(t)
slist = list()
tlist = list()

if len(sset) != len(tset):
   print("No")
else:
   for i in range(len(s)):
      smoji = s[i]
      if s[i] in slist:
         continue
      else:
         si = string(i)
         ss = s.replace(s[i], si)
   for i in range(len(t)):
      tmoji = t[i]
      if t[i] in tlist:
         continue
      else:
         ti = string(i)
         ts = t.replace(t[i], ti)
   if ss != ts:
      print("No")
   else:
      print("Yes")



s = input()
t = input()

sset = set(s)
tset = set(t)
slist = list()
tlist = list()

for i in range(len(s)):
      smoji = s[i]
      if s[i] in slist:
         continue
 else:
      si = string(i)
      ss = s.replace(s[i], si)
for i in range(len(t)):
    tmoji = t[i]
    if t[i] in tlist:
      continue
    else:
      ti = string(i)
      ts = t.replace(t[i], ti)

if len(sset) != len(tset):
   print("No")
else:
   if ss != ts:
      print("No")
   else:
      print("Yes")



s = input()
t = input()

sset = set(s)
tset = set(t)
slist = list()
tlist = list()

for i in range(len(s)):
   smoji = s[i]
   if s[i] in slist:
      continue
   else:
      si = string(i)
      ss = s.replace(s[i], si)
for i in range(len(t)):
    tmoji = t[i]
    if t[i] in tlist:
      continue
    else:
       ti = string(i)
       ts = t.replace(t[i], ti)

if len(sset) != len(tset):
   print("No")
else:
   if ss != ts:
      print("No")
   else:
      print("Yes")



S = input()
T = input()

i = 0
j = 0
ss = list()
tt = list()
slist = list()
tlist = list()

if len(s) == len(t):
   for s in S:
      if s in slist:
         ss.append(slist[s])
      else:
         ss.append(i)
         slist.append(s)
         i += 1

   for t in T:
      if t in tlist:
         tt.append(tlist[t])
      else:
         tt.append(j)
         tlist.append(t)
         j += 1

   if ss == tt:
      print("Yes")
   else:
      print("No")
else:
   print("No")
      
      
         


S = input()
T = input()

i = 0
j = 0
ss = list()
tt = list()
slist = list()
tlist = list()

for s in S:
   if s in slist:
      ss.append(slist[s])
   else:
      ss.append(i)
      slist.append(s)
      i += 1

for t in T:
   if t in tlist:
      tt.append(tlist[t])
   else:
      tt.append(j)
      tlist.append(t)
      j += 1

if ss == tt:
   print("Yes")
else:
   print("No")

      
      
         

s = input()
t = input()

sset = set(s)
tset = set(t)
slist = list()
tlist = list()

for i in range(len(s)):
   smoji = s[i]
   if s[i] in slist:
      continue
   else:
      si = string(i)
      s.replace(s[i], si)
for i in range(len(t)):
   tmoji = t[i]
    if t[i] in tlist:
      continue
    else:
       ti = string(i)
       t.replace(t[i], ti)

    
if len(sset) != len(tset):
   print("No")
else:
   if s != t:
      print("No")
   else:
      print("Yes")



S = input()
T = input()

i = 0
j = 0
ss = list()
tt = list()
slist = list()
tlist = list()

if len(S) == len(T):
   for s in S:
      if s in slist:
         ss.append(slist.index(s))
      else:
         ss.append(i)
         slist.append(s)
         i += 1

   for t in T:
      if t in tlist:
         tt.append(tlist.index(t))
      else:
         tt.append(j)
         tlist.append(t)
         j += 1

   if ss == tt:
      print("Yes")
   else:
      print("No")
else:
   print("No")
      
      
         


Verdicts: Runtime Error

Runtime Error

Runtime Error

Runtime Error

Runtime Error

Runtime Error

Runtime Error

Runtime Error

Runtime Error

Accepted