TnT/Multi_CodeNet4Repair huggingface dataset:
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):
d={}
w1=input()
w2=input()
num=len(w1)
b=True
for i in list("qwertyuiopasdfghjklzxcvbnm"):
  d[i]=""
for i in range(num):
  if d[w1[i]]=="":
    d[w1[i]]=w2[i]
  elif d[w1[i]]==w2[i]:
    pass
  elif d[w1[i]]!=w2[i]:
    b=False
    break
if b:
  print("No")
else:
  l=[]
  for i in d:
    if d[i] in l:
      b=False
      break
    else:
      if d[i]!="":
        l.append(d[i])
  if b:
    print("Yes")
  else:
    print("No")
    


d={}
w1=input()
w2=input()
num=len(w1)
b=True
for i in list("qwertyuiopasdfghjklzxcvbnm"):
  d[i]=""
for i in range(num):
  if d[w1[i]]=="":
    d[w1[i]]=w2[i]
  elif d[w1[i]]==w2[i]:
    pass
  elif d[w1[i]]!=w2[i]:
    b=False
    break
if not b:
  print("No")
else:
  l=[]
  for i in d:
    if d[i] in l:
      b=False
      break
    else:
      if d[i]!="":
        l.append(d[i])
  if b:
    print("Yes")
  else:
    print("No")
    



Verdicts: Wrong Answer

Accepted
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()
for i in range(len(s)):
  if s[i] == t[i]:
  else:
    s = s.translate(str.maketrans(s[i]+t[i],t[i]+s[i]))

if s == t:
  print("Yes")
else:
  print("No")

s = input()
t = input()
used_str = []
for i in range(len(s)):
  if s[i] != t[i] and not s[i] in used_str and not t[i] in used_str:
    s = s.translate(str.maketrans(s[i]+t[i],t[i]+s[i]))
    used_str.append(s[i])
    used_str.append(t[i])

if s == t:
  print("Yes")
else:
  print("No")

Verdicts: Runtime Error

Accepted
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):
import sys
s=input()
t=input()
def hanten(*S,c1,c2):
  for i range(len(S)):
    if S[i]==c1:
      S[i]=c2
    if S[i]==c2:
      S[i]=c1
for j,k in s:
  if hanten(s,j,k)==t:
    print('Yes')
    sys.exit()
print('No')

import collections
s=input()
t=input()
cnt1=1
cnt2=1
lst1=[]
lst2=[]
for i in range(len(s)-1):
  if s[i]==s[i+1]:
    cnt1+=1
  else:
    lst1.append(cnt1)
for j in range(len(t)-1):
  if t[j]==t[j+1]:
    cnt2+=1
  else:
    lst2.append(cnt2)
S=collections.Counter(s)
T=collections.Counter(t)
S_=list(S.values())
T_=list(T.values())
S_.sort()
T_.sort()
if S_==T_ and lst1==lst2:
  print('Yes')
else:
  print('No')

    

Verdicts: Runtime Error

Accepted
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):
a=input()
b=input()
c={}
state=True
for i in range(len(a)):
  if b[i] not in c:
    c[b[i]]=a[i]
  if b[i] in c:
    if c[b[i]]!=a[i]:
    state=False
  else:
    state=False
if state:
  print('Yes')
else:
  print('No')

a=input()
b=input()
c={}
state=True
for i in range(len(a)):
  b[i] not in c:
    c[b[i]]=a[i]
    c[a[i]]=b[i]
  if c[b[i]]!=a[i]:
    state=False
if state:
  print('Yes')
else:
  print('No')
    
  

a=input()
b=input()
c={}
state=True
for i in range(len(a)):
  if b[i] not in c and a[i] not in c.values():
    c[b[i]]=a[i]
  if b[i] in c:
    if c[b[i]]!=a[i]:
      state=False
  else:
    state=False
if state:
  print('Yes')
else:
  print('No')


Verdicts: Runtime Error

Runtime Error

Accepted
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):
from collections import Counter
s=input()
t=input()
c1=Counter(s)
c2=Counter(t)
c1.sort()
c2.sort()
print('Yes' if c1==c2 else 'No')

from collections import Counter
s=input()
t=input()
c1=list(Counter(s).values())
c2=list(Counter(t).values())
c1.sort()
c2.sort()
print('Yes' if c1==c2 else 'No')


Verdicts: Runtime Error

Accepted
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_to_t = {}
t_to_s = {}

for i in range(len(s)):
    if s[i] not in s_to_t:
        if t[i] not in t_to_s:
            s_to_t[s[i]] = t[i]
            t_to_s[t[i]] = s[i]
            continue
        else:
            print('No')
            exit(0)
    elif s_to_t[s[i]] == t[i] and t_to_s[t[i]] == s[i]:
        continue
    else:
        print('No')
        exit(0)
        
print('Yes')            


s = input()
t = input()


s_to_t = {}
t_to_s = {}

for i in range(len(s)):
    if s[i] not in s_to_t:
        if t[i] not in t_to_s:
            s_to_t[s[i]] = t[i]
            t_to_s[t[i]] = s[i]
            continue
        else:
            print('No')
            exit(0)
    elif s_to_t[s[i]] == t[i] and t_to_s[t[i]] == s[i]:
        continue
    else:
        print('No')
        exit(0)
        
print('Yes')            
    


Verdicts: Runtime Error

Accepted
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_str = [ord(i) for i in input()]
t_str = [ord(i) for i in input()]

s = sorted(s_str)
t = sorted(t_str)

cnt_s = 1
cnt_t = 1
s_num = []
t_num = []

for i in range(len(s)-1):
    if s[i] == s[i+1]:
        cnt_s += 1
        if i == len(s)-2:
            s_num.append(cnt_s)
    else:
        s_num.append(cnt_s)
        cnt_s = 1
    if t[i] == t[i+1]:
        cnt_t += 1
        if i == len(s)-2:
            t_num.append(cnt_t)
    else:
        t_num.append(cnt_t)
        cnt_t = 1

s_num = sorted(s_num)
t_num = sorted(t_num)
print(s_num)
print(t_num)

if s_num == t_num:
    print("Yes")
else:
    print("No")



s_str = [ord(i) for i in input()]
t_str = [ord(i) for i in input()]

s = sorted(s_str)
t = sorted(t_str)

cnt_s = 1
cnt_t = 1
s_num = []
t_num = []

for i in range(len(s)-1):
    if s[i] == s[i+1]:
        cnt_s += 1
        if i == len(s)-2:
            s_num.append(cnt_s)
    else:
        s_num.append(cnt_s)
        cnt_s = 1
    if t[i] == t[i+1]:
        cnt_t += 1
        if i == len(s)-2:
            t_num.append(cnt_t)
    else:
        t_num.append(cnt_t)
        cnt_t = 1

s_num = sorted(s_num)
t_num = sorted(t_num)

if s_num == t_num:
    print("Yes")
else:
    print("No")



Verdicts: Wrong Answer

Accepted
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):
import sys
import collections

s = list(map(str,input()))
t = list(map(str,input()))
cnts = collections.Counter(s)
cntt = collections.Counter(t)
cs = sorted(cnts.values())
ct = sorted(cntt.values())

print(cs)
print(ct)

if len(s) != len(t):
    print("No")
    sys.exit()

for i,j in zip(cs,ct):
    if i != j:
        print("No")
        sys.exit()

print("Yes")

import sys
import collections

s = list(map(str,input()))
t = list(map(str,input()))
cnts = collections.Counter(s)
cntt = collections.Counter(t)
cs = sorted(cnts.values())
ct = sorted(cntt.values())

print(cnts)
print(cntt)

if len(s) != len(t):
    print("No")
    sys.exit()

for i,j in zip(cnts.values(),cntt.values()):
    if i != j:
        print("No")
        sys.exit()

print("Yes")

import sys
import collections

s = list(map(str,input()))
t = list(map(str,input()))
cnts = collections.Counter(s)
cntt = collections.Counter(t)
cs = sorted(cnts.values())
ct = sorted(cntt.values())

if len(s) != len(t):
    print("No")
    sys.exit()

for i,j in zip(cs,ct):
    if i != j:
        print("No")
        sys.exit()

print("Yes")

Verdicts: Wrong Answer

Wrong Answer

Accepted
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()

dic = {}
dic_rev = {}


def solve():
    for s, t in zip(S, T):
        if t in dic.keys():
            if s != dic[t]:
                print('No')
                return
        else:
            dic[t] = s
    for s, t in zip(S, T):
        if t in dic_rev.keys():
            if t != dic_rev[s]:
                print('No')
                return
        else:
            dic_rev[s] = t
    print('Yes')
    return


solve()


S = input()
T = input()

dic = {}
dic_rev = {}


def solve():
    for s, t in zip(S, T):
        if t in dic.keys():
            if s != dic[t]:
                print('No')
                return
        else:
            dic[t] = s
    for s, t in zip(S, T):
        if s in dic_rev.keys():
            if t != dic_rev[s]:
                print('No')
                return
        else:
            dic_rev[s] = t
    print('Yes')
    return


solve()

Verdicts: Runtime Error

Accepted
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):
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

import sys

input = sys.stdin.readline

def main():
    T2 = T[:]
    for i in range(len(S)):
        if S[i] == T2[i]:
            continue
        from_c = T2[i]
        to_c = S[i]
        T2 = T2.translate(str.maketrans({from_c: to_c, to_c: from_c}))

    if S != T2:
        print("No")
    else:
        print("Yes")

main()


#!/usr/bin/env python3
# -*- coding: utf-8 -*-

import sys

input = sys.stdin.readline

def main():
    S = input().strip()
    T = input().strip()
    m = {}
    for i in range(len(T)):
        if T[i] in m:
            if m[T[i]] != S[i]:
                print("No")
                return
        m[T[i]] = S[i]

    T2 = T[:]
    for i in range(len(S)):
        if S[i] == T2[i]:
            continue
        from_c = T2[i]
        to_c = S[i]
        T2 = T2.translate(str.maketrans({from_c: to_c, to_c: from_c}))

    if S != T2:
        print("No")
    else:
        print("Yes")

main()


Verdicts: Runtime Error

Accepted
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 = list(input())
t = list(input())
n = len(s)

s_par = [i for i in range(n + 1)]
t_par = [i for i in range(n + 1)]

def operation(x, par):
    for i in range(n):
        for j in range(i):
            if x[i] == x[j]:
                par[i] = par[j]
                return par

if operation(s, s_par) == operation(t, t_par):
    print('yes')
else:
    print('No')

s = list(input())
t = list(input())
n = len(s)

s_par = [i for i in range(n + 1)]
t_par = [i for i in range(n + 1)]

def operation(x, par):
    for i in range(n):
        for j in range(i):
            if x[i] == x[j]:
                par[i] = par[j]
                break
    return par

if operation(s, s_par) == operation(t, t_par):
    print('Yes')
else:
    print('No')

Verdicts: Wrong Answer

Accepted
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=sorted(map(list(input()).count,set(s)))
t=sorted(map(list(input()).count,set(t)))
print("Yes" if s==t else "No")

from collections import Counter
s=Counter(input())
t=Counter(input())
S=sorted(s.values())
T=sorted(t.values())
print("Yes" if S==T else "No")

Verdicts: Runtime Error

Accepted
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):
import sys
from collections import Counter


def main():
    s = input()
    t = input()
    s_count = [0]*26
    t_count = [0]*26
    for i in range(ord("a"), ord("z")+1):
        s_count[i-97] = s.count(chr(i))
        t_count[i-97] = t.count(chr(i))
        print(s_count[i-97], t_count[i-97])
    s_count.sort()
    t_count.sort()
    if s_count == t_count:
        print("Yes")
    else:
        print("No")


if __name__ == "__main__":
    main()


import sys
from collections import Counter


def main():
    s = input()
    t = input()
    s_count = [0]*26
    t_count = [0]*26
    for i in range(ord("a"), ord("z")+1):
        s_count[i-97] = s.count(chr(i))
        t_count[i-97] = t.count(chr(i))
    s_count.sort()
    t_count.sort()
    if s_count == t_count:
        print("Yes")
    else:
        print("No")


if __name__ == "__main__":
    main()


Verdicts: Wrong Answer

Accepted
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()
n=len(s)

dic={}
ans='Yes'
for i in range(n):
    if s[i] in dic:
        if dic[t[i]]==t[i]:
            continue
        else:
            ans='No'
            break
    
    if t[i] not in dic:
        dic[t[i]]=s[i]
    else:
        if dic[t[i]]==s[i]:
            continue
        else dic[t[i]] !=s[i]:
            ans='No'
            break

print(ans)

s=input()
t=input()

dic={}

ans=True
for i in range(len(s)):
    if s[i]==t[i]:
        continue
    else:
        if s[i] not in dic:
            dic[s[i]]=t[i]
        else:
            if dic[s[i]]!=t[i]:
                ans=False
                break
print(ans)
se=set()
for key,value in dic.items():
    se.add(value)
if len(se)!=len(dic):
    ans=False
    
print('Yes' if ans else 'No')


s=input()
t=input()
n=len(s)

dic={}
ans='Yes'
for i in range(n):
    if s[i]==t[i] and s[i] in dic:
        ans='No'
        break
    
    if t[i] not in dic:
        dic[t[i]]=s[i]
    else:
        if dic[s[i]]==t[i]:
            continue
        else:
            ans='No'
            break

print(ans)

s=input()
t=input()
n=len(s)

dic={}
ans='Yes'
for i in range(n):
    if t[i] not in dic:
        dic[t[i]]=s[i]
    
    else:
        if dic[t[i]]==s[i]:
            continue
        else :
            ans='No'
            break
    
if len(dic)!len(set(dic.values())):
    ans='No'
print(ans)

s=input()
t=input()
n=len(s)

dic={}
ans='Yes'
for i in range(n):
    if s[i] in dic:
        if dic[t[i]]==t[i]:
            continue
        else:
            ans='No'
            break
    
    if t[i] not in dic:
        dic[t[i]]=s[i]
    else:
        if dic[t[i]]==s[i]:
            continue
        else :
            ans='No'
            break

print(ans)


s=input()
t=input()
n=len(s)
dic={}
se=set()
ans='Yes'
for i in range(n):
    if s[i] not in dic:
        dic[s[i]]=t[i]
        if t[i] in se:
            ans='No'
        se.add(t[i])
    else:
        if dic[s[i]]!=t[i]:
            ans='No'
print(ans)
                


Verdicts: Runtime Error

Wrong Answer

Runtime Error

Runtime Error

Runtime Error

Accepted
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):
from math import ceil,floor,comb,factorial,gcd,pow,sqrt,log2,cos,sin,tan,acos,asin,atan,degrees,radians,pi,inf
from itertools import accumulate,permutations,combinations,product,combinations_with_replacement
from collections import deque,defaultdict,Counter
from bisect import bisect_left,bisect_right
from operator import itemgetter
from heapq import heapify,heappop,heappush
from copy import deepcopy
from time import time
import string
import sys
sys.setrecursionlimit(10 ** 7)
def input() : return sys.stdin.readline().strip()
def INT()   : return int(input())
def MAP()   : return map(int,input().split())
def LIST()  : return list(MAP())

s = input()
t = input()
a = [0]*(ord('z')+1)
b = [0]*(ord('z')+1)

for i in range(len(s)):
    x = ord(s[i])
    y = ord(t[i])
    if x != y and a[x] != y:
        if a[x] == 0:
            a[x] = y
            b[x] = 1
        else:
            print("No")
            exit()
if sum(b) % 2 == 1:
    print("No")
else:
    print("Yes")

from math import ceil,floor,comb,factorial,gcd,pow,sqrt,log2,cos,sin,tan,acos,asin,atan,degrees,radians,pi,inf
from itertools import accumulate,permutations,combinations,product,combinations_with_replacement
from collections import deque,defaultdict,Counter
from bisect import bisect_left,bisect_right
from operator import itemgetter
from heapq import heapify,heappop,heappush
from copy import deepcopy
from time import time
import string
import sys
sys.setrecursionlimit(10 ** 7)
def input() : return sys.stdin.readline().strip()
def INT()   : return int(input())
def MAP()   : return map(int,input().split())
def LIST()  : return list(MAP())

s = input()
t = input()
a = [0]*26
b = [0]*26

for i in range(len(s)):
    x = ord(s[i])-ord('a')
    y = ord(t[i])-ord('a')
    a[x] += 1
    b[y] += 1

if sorted(a) == sorted(b):
    print("Yes")
else:
    print("No")

Verdicts: Wrong Answer

Accepted
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):
import sys

S = input()
T = input()

len_S = len(S)
S_Converted = S
for i in range (len(S)):
    tmp_S = S_Converted[i]
    tmp_T = T[i]
    if tmp_S == tmp_T:
        continue
    S_Converted = list(S_Converted) 
    list_indexT = [j for j, tmp_SC in enumerate(S_Converted) if tmp_SC == tmp_T]
    if (not list_indexT == []) and (list_indexT[0] < i):
        print('No')
        sys.exit()
    S_Converted = ''.join(S_Converted)
    S_Converted = S_Converted.replace(tmp_S, tmp_T)
    S_Converted = list(S_Converted) 
    for li in list_indexT:
        if li == i:
            continue
        else:
            S_Converted[li] = tmp_S
    print(''.join(S_Converted))
    
S_Converted = ''.join(S_Converted)

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

    

import sys

S = input()
T = input()

len_S = len(S)
S_Converted = S
for i in range (len(S)):
    tmp_S = S_Converted[i]
    tmp_T = T[i]
    if tmp_S == tmp_T:
        continue
    S_Converted = list(S_Converted) 
    list_indexT = [j for j, tmp_SC in enumerate(S_Converted) if tmp_SC == tmp_T]
    if (not list_indexT == []) and (list_indexT[0] < i):
        print('No')
        sys.exit()
    S_Converted = ''.join(S_Converted)
    S_Converted = S_Converted.replace(tmp_S, tmp_T)
    S_Converted = list(S_Converted) 
    for li in list_indexT:
        if li == i:
            continue
        else:
            S_Converted[li] = tmp_S
    #print(''.join(S_Converted))
    
S_Converted = ''.join(S_Converted)

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

Verdicts: Wrong Answer

Accepted
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, T = [input() for _ in range(2)]
smemo, tmemo = {}, {}
for si, ti in zip(S, T):
    if si in smemo and smemo[si] != ti or ti in tmemo and tmemo[ti] != si:
        print("NO")
        quit()
    smemo[si], tmemo[ti] = ti, si
print("YES")


S, T = [input() for _ in range(2)]
smemo, tmemo = {}, {}
for si, ti in zip(S, T):
    if si in smemo and smemo[si] != ti or ti in tmemo and tmemo[ti] != si:
        print("No")
        quit()
    smemo[si], tmemo[ti] = ti, si
print("Yes")


Verdicts: Wrong Answer

Accepted
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):
import collections
a = list(input())
b = list(input())
A = collections.Counter(a)
B = collections.Counter(b)
Asort = sorted(A.values())
Bsort = sorted(B.values())
if list(Asort.values()) == list(Bsort.values()):
  print("Yes")
else:
  print("No")

import collections
a = list(str(input()))
b = list(str(input()))
A = collections.Counter(a)
B = collections.Counter(b)
Asort = sorted(A.values())
Bsort = sorted(B.values())
if list(Asort.values()) == list(Bsort.values()):
  print("Yes")
else:
  print("No")

import collections
a = list(map(str,input().split()))
b = list(map(str,input().split()))
A = collections.Counter(a)
B = collections.Counter(b)
Asort = sorted(A.values())
Bsort = sorted(B.values())
if Asort.values() == Bsort.values():
  print("Yes")
else:
  print("NO")

import collections
a = list(str(input()))
b = list(str(input()))
A = collections.Counter(a)
B = collections.Counter(b)
Asort = sorted(A.values())
Bsort = sorted(B.values())
if Asort.values() == Bsort.values():
  print("Yes")
else:
  print("No")

import collections
a = list(input())
b = list(input())
A = collections.Counter(a)
B = collections.Counter(b)
Asort = sorted(A.values())
Bsort = sorted(B.values())
if Asort.values() == Bsort.values():
  print("Yes")
else:
  print("NO")

import collections
a = list(input())
b = list(input())
A = collections.Counter(a)
B = collections.Counter(b)
Alist = list(A.values())
Blist = list(B.values())
Asort = sorted(Alist)
Bsort = sorted(Blist)
if Asort == Bsort:
  print("Yes")
else:
  print("No")

Verdicts: Runtime Error

Runtime Error

Runtime Error

Runtime Error

Runtime Error

Accepted
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()

D={}

ans=1
for s,t in zip(S,T):
    x=D.get(t, '')
    print(s,t,x)
    if x=='':
        D[t]=s
    else:
        print(s,t,x)
        if x!=s:
            ans=0
            break
            

print('Yes' if ans else 'No')

S=input()
T=input()

D1={}
D2={}

ans=1
for s,t in zip(S,T):
    x=D1.get(t, '')
    if x=='':
        D1[t]=s
    else:
        if x!=s:
            ans=0
            break
            
    x=D2.get(s, '')
    if x=='':
        D2[s]=t
    else:
        if x!=t:
            ans=0
            break

print('Yes' if ans else 'No')

Verdicts: Wrong Answer

Accepted
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()
a = "abcdefghijklmnopqrstuvwxyz"

flag = 0
i = 0 
while i < len(s):
	if s[i] != t[i]:
		if t[i] in a:
			c = s[i]
			s = s.replace(c, "1")
			s = s.replace(t[i], c)
			s = s.replace("1", t[i])
			a = a.replace(t[i], "1")
		else:
			break
	i += 1
if s == t:
	print("True")
else:
	print("False")

s = input()
t = input()
a = "abcdefghijklmnopqrstuvwxyz"

flag = 0
i = 0 
while i < len(s):
	if s[i] != t[i]:
		if t[i] in a:
			c = s[i]
			s = s.replace(c, "1")
			s = s.replace(t[i], c)
			s = s.replace("1", t[i])
			a = a.replace(t[i], "1")
		else:
			break
	i += 1
if s == t:
	print("Yes")
else:
	print("No")

Verdicts: Wrong Answer

Accepted
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=str(input())
t=str(input())
temp=["a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"]
s=list(set(s))
t=list(set(t))
temps=[0]*len(temp)
tempt=[0]*len(temp)
for i in range(0,len(temp)):
  temps[i]=s.count(temp[i])
  tempt[i]=t.count(temp[i])
if temps==tempt:
  print("Yes")
else:
  print("No")

s=str(input())
t=str(input())
temps=list(set(s))
tempt=list(set(t))
temps=sorted(temps)
tempt=sorted(tempt)
for i in range(0,len(temps)):
  temps1[i]=s.count(temps[i])
for i in range(0,len(tempt)):
  tempt1[i]=t.count(tempt[i])
if temps1==tempt1:
  print("Yes")
else:
  print("No")

s=str(input())
t=str(input())
s=sorted(list(s))
t=sorted(list(t))
temps=list(set(s))
tempt=list(set(t))
for i in range(0,len(temps)):
  temps[i]=s.count(temps[i])
for i in range(0,len(tempt)):
  tempt[i]=t.count(tempt[i])
if temps==tempt:
  print("Yes")
else:
  print("No")

s=str(input())
t=str(input())
s=sorted(list(s))
t=sorted(list(t))
temps=list(set(s))
tempt=list(set(t))
for i in range(0,len(temps)):
  temps[i]=s.count(temps[i])
for i in range(0,len(tempt)):
  tempt[i]=s.count(tempt[i])
if temps==tempt:
  print("Yes")
else:
  print("No")

s=str(input())
t=str(input())
temp=["a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"]
s=list(s)
t=list(t)
temps=[0]*len(temp)
tempt=[0]*len(temp)
for i in range(0,len(temp)):
  temps[i]=s.count(temp[i])
  tempt[i]=t.count(temp[i])
temps.sort()
tempt.sort()
if temps==tempt:
  print("Yes")
else:
  print("No")

Verdicts: Wrong Answer

Runtime Error

Wrong Answer

Wrong Answer

Accepted
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):
ch_S = input()
ch_T = input()

ind_S = []
ind_T = []
for i in list("abcdefghijklmnopqrstuvwxyz"):
    L = [ch_S.find(i)]
    ind_S.append(L, )
    R = [ch_T.find(i)]
    ind_T.append(R,)

if set(ind_S) == set(ind_T):
    print("Yes")
else:
    print("No")


S = input()
T = input()
ls = [0]*26
lt = [0]*26
al = [chr(ord('a')+i) for i in range(26)]
for i in range(S.__len__()):
    si = al.index(S[i])
    ti = al.index(T[i])
    ls[si] += 1
    lt[ti] += 1
ls.sort()
lt.sort()
if ls == lt:
    print("Yes")
else:
    print("No")


Verdicts: Runtime Error

Accepted
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()
ans = 'Yes'
for i in T:
    if i in S:
        continue
    else:
        ans = 'No'
        break

print(ans)

S = input()
T = input()
ans = 'Yes'
dic1,dic2 = {},{}

for i,j in zip(S,T):
    if i in dic1:
        if dic1[i] != j:
            ans = 'No'
    else:
        dic1[i] = j
        
    if j in dic2:
        if dic2[j] != i:
            ans = 'No'
    else:
        dic2[j] = i

#print(dic1)
#print(dic2)
print(ans)

Verdicts: Wrong Answer

Accepted
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()

S1 = sorted(S)
T1 = sorted(T)

count1 = 0
count2 = 0

for j in range(26):
    for i in range(len(S1)):
        if string.ascii_lowercase[j] == S1[i]:
            count1 += 1
            break
    for i in range(len(T1)):
        if string.ascii_lowercase[j] == T1[i]:
            count2 += 1
            break

if count1 == count2:
    print("Yes")
else:
    print("N0")

import string

S = input()
T = input()

count1 = [0] * 26
count2 = [0] * 26


for j in range(25):
    count1[j] = S.count(string.ascii_lowercase[j])
    count2[j] = T.count(string.ascii_lowercase[j])

hantei = 1

for i in range(1,len(S)+1):
    count_tmp1 = 0
    count_tmp2 = 0
    for j in range(25):
        if i == count1[j] :
            count_tmp1 += 1
        elif i == count2[j] :
            count_tmp2 += 1
    if count_tmp1 != count_tmp2:
        hantei = 0
        break

if hantei == 0:
    print("No")
else:
    print("Yes")

import string

S = input()
T = input()

count1 = [0] * 26
count2 = [0] * 26


for j in range(26):
    count1[j] = S.count(string.ascii_lowercase[j])
    count2[j] = T.count(string.ascii_lowercase[j])

hantei = 1

for i in range(0,len(S)+1):
    count_tmp1 = 0
    count_tmp2 = 0
    for j in range(26):
        if i == count1[j] :
            count_tmp1 += 1
    for j in range(26):
        if i == count2[j] :
            count_tmp2 += 1
    if count_tmp1 != count_tmp2:
        hantei = 0
        break

if hantei == 0:
    print("No")
else:
    print("Yes")


Verdicts: Runtime Error

Wrong Answer

Accepted
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 = sorted(input())
t = sorted(input())
if s == t:
  print('Yes')
else:
  print('No')


s = int(input())
t = int(input())

from collections import Counter
SC = Counter(s)
TC = Counter(s)

SCV = SC.values()
TCV = TC.values()

SCV.sort()
TCV.sort()

if SCV == TCV:
  print('Yes')
else:
  print('No')


s = int(input())
t = int(input())

from collections import Counter
SC = Counter(s)
TC = Counter(t)

SCV = SC.values()
TCV = TC.values()

SCV.sort()
TCV.sort()
ans = 1
for i in range(len(s)):
  if SCV[i] != TCV[i]:
    ans = 0

if ans == 1:
  print('Yes')
else:
  print('No')
    
    


S,T = input(),input()

convert = dict()

bl = True
for s,t in zip(S,T):
  if s in convert and convert[s] != t:
    bl = False
    break
  convert[s] = t


after = convert.values()
if len(after) != len(set(after)):
  bl = False

print('Yes' if bl else 'No')


Verdicts: Wrong Answer

Runtime Error

Runtime Error

Accepted
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()
if s == t:
	pritn('Yes')
	exit()
if len(s) == 1:
	if s != t:
		print('No')
        exit(
for i in range(len(t)):
	for j in range(len(t)):
		if t[i] == t[j] and s[i] != s[j]:
			print('No')
			exit()
print('Yes')


s = input()
t = input()

start = [-1]*26
goal = [-1]*26
for i in range(len(s)):
	a = ord(s[i]) - ord('a')
	b = ord(t[i]) - ord('a')
	if start[a] != -1 or goal[b] != -1:
		if start[a] != b or goal[b] != a:
			print('No')
			exit()
	start[a] = b
	goal[b] = a
print('Yes')

Verdicts: Runtime Error

Accepted
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()
s_list = []
t_list = []

for i in range(26):
    s_list.append(s.count(chr(97+i)))
    t_list.append(t.count(chr(97+i)))

s_list.sort()
t_list.sort()
true = 0
for i in range(26):
    if s_list[i] != t_list[i]:
        print('no')
        break
    else:
        true += 1
if true == 26:
    print('yes')


s = input()
t = input()
s_list = []
t_list = []

for i in range(26):
    s_list.append(s.count(chr(97+i)))
    t_list.append(t.count(chr(97+i)))

s_list.sort()
t_list.sort()
true = 0
for i in range(26):
    if s_list[i] != t_list[i]:
        print('No')
        break
    else:
        true += 1
if true == 26:
    print('Yes')


Verdicts: Wrong Answer

Accepted
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):
import sys

S = input()
T = input()

changes = {}
for i in range(len(T)):
    print(changes)
    if S[i] != T[i]:
        if S[i] in changes:
            if changes[S[i]] != T[i]:
                print('No')
                sys.exit(0)
        if T[i] in changes:
            if changes[T[i]] != S[i]:
                print('No')
                sys.exit(0)

        changes[S[i]] = T[i]
        changes[T[i]] = S[i]

print('Yes')

import sys

S = input()
T = input()

changes = {}
changes_reverse = {}
for i in range(len(T)):
    #print(changes)
    if S[i] != T[i]:
        if S[i] in changes:
            if changes[S[i]] != T[i]:
                print('No')
                sys.exit(0)
        if T[i] in changes_reverse:
            if changes_reverse[T[i]] != S[i]:
                print('No')
                sys.exit(0)

        changes[S[i]] = T[i]
        changes_reverse[T[i]] = S[i]
    else:
        changes[S[i]] = T[i]
        changes_reverse[T[i]] = S[i]
        

print('Yes')
# print(changes)


Verdicts: Wrong Answer

Accepted
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()

c1=[[] for i in abc]
c2=[[] for i in abc]
for i in range(0,len(S)):
    c1[ord(S[i])-ord("a")].append(i)

for i in range(0,len(T)):
    c2[ord(T[i])-ord("a")].append(i)

ans="Yes"
for i in c1:
    if(i not in c2):
        ans="No"
        break
    
print(ans)

abc=list("abcdefghijklmnopqrstuvwxyz")
S=input()
T=input()

c1=[[] for i in abc]
c2=[[] for i in abc]
for i in range(0,len(S)):
    c1[ord(S[i])-ord("a")].append(i)

for i in range(0,len(T)):
    c2[ord(T[i])-ord("a")].append(i)

ans="Yes"
for i in c1:
    if(i not in c2):
        ans="No"
        break
    
print(ans)

Verdicts: Runtime Error

Accepted
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()
SS = {}
TT = {}
for i in range(len(S)):
    s = S[i]
    t = T[i]
    if s not in SS:
        SS[s] = t
    elif SS[s] != t:
        print("No")
        break
    if if t not in TT:
        TT[t] = s
    elif TT[t] != s:
        print("No")
        break
else:
    print("Yes")

S= input()
T= input()
SS = {}
TT = {}
for i in range(len(S)):
    s = S[i]
    t = T[i]
    if s not in SS:
        SS[s] = t
    elif SS[s] != t:
        print("No")
        break
    if t not in TT:
        TT[t] = s
    elif TT[t] != s:
        print("No")
        break
else:
    print("Yes")

Verdicts: Runtime Error

Accepted
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):
import itertools
import math


S = input()
T = input()

pairs = itertools.combinations(set(S + T), 2)
depth_max = math.floor(len(set(S + T)) / 2)

for depth in range(1, depth_max + 1):
    mid_S = S
    for i in range(depth):
        new_S = mid_S
        for c1, c2 in pairs:
            new_S = new_S.replace(c1, c2.upper())
            new_S = new_S.replace(c2, c1.upper())
            new_S = new_S.lower()
            if new_S == T:
                print('Yes')
                exit()

print('No')


import collections

S = input()
T = input()

S_count = [v for v in collections.Counter(S).values()]
S_count.sort()
T_count = [v for v in collections.Counter(T).values()]
T_count.sort()

if S_count == T_count:
    print('Yes')
else:
    print('No')


Verdicts: Wrong Answer

Accepted
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 = list(input())
T = list(input())

dic = {}
sets = set()
flag = True
for s,t in S,T:
  if s in sets:
    if dic[s] != t:
      flag = False
      break
  else:
    sets.add(s)
    dic[s] = t
    
if flag:
  print('Yes')
else:
  print('No')

#from collections import Counter

S = list(input())
T = list(input())

dics = {}
dicst= {}
sets = set()
sett = set()
flag = True
for i in range(len(S)):
    s = S[i]
    t = T[i]
    if s in sets and t in sett:
        if dics[s] != t or dicst[t] != s:
            flag = False
            break
    elif s in sets and not(t in sett):
        flag = False
        break
    elif t in sett and not(s in sets):
        flag = False
        break
    else:
        sets.add(s)
        sett.add(t)
        dics[s] = t
        dicst[t] = s
    
print('Yes') if flag else print('No')

Verdicts: Runtime Error

Accepted
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):
if __name__ == '__main__':
    S = list(input())
    T = list(input())

    letter = []
    for i in range(len(S)):
        letter.append(T[i])                                                                                                                                                     if S[i] == T[i]:
            continue
        else:
            if S[i] in letter:
                break
            else:
                s = S[i]
                for j in range(len(S)):
                    if S[j] == s:
                        S[j] = T[i]
                    elif S[j] == T[i]:
                        S[j] = s

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

if __name__ == '__main__':
    S = list(input())
    T = list(input())

    letter = []
    for i in range(len(S)):
        letter.append(T[i])                                                                                                                                                     if S[i] == T[i]:
            continue
        else:
            if S[i] in letter:
                break
            else:
                s = S[i]
                for j in range(len(S)):
                    if S[j] == s:
                        S[j] = T[i]
                    elif S[j] == T[i]:
                        S[j] = s

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

if __name__ == '__main__':
    S = list(input())
    T = list(input())

    start = [-1 for i in range(26)]
    stop = [-1 for i in range(26)]

    fail = False
    for i in range(len(S)):
        a = ord(S[i]) - ord('a')
        b = ord(T[i]) - ord('a')

        if start[a] != -1 or stop[b] != -1:
            if start[a] != b or stop[b] != a:
                print('No')
                fail = True
                break
        else:
            start[a] = b
            stop[b] = a

    if not fail:
        print('Yes')

Verdicts: Runtime Error

Runtime Error

Accepted
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):
from collections import*;C=Counter;print('YNeos'[eval('!=C(C(input()).values())'*2[2:])::2])

s,t=[sorted(t.count(i)for i in set(t))for t in open(0)]
print('YNeos'[s!=t::2])

Verdicts: Runtime Error

Accepted
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()


# for c in range(ord('a'), ord('z') + 1):
#     snum.append([i for i, x in enumerate(s) if x == chr(c)])
# for c in range(ord('a'), ord('z') + 1):
#     tnum.append([i for i, x in enumerate(t) if x == chr(c)])
# snum.sort()
# tnum.sort()



sn=[0 for i in range(26)]
tn=[0 for i in range(26)]
for i in range(len(s)):
    sn[ord(s[i])]+=1
    tn[ord(t[i])]+=1
print('Yes' if sorted(sn) == sorted(tn) else 'No')



s = input()
t = input()
sn=[0 for i in range(26)]
tn=[0 for i in range(26)]
for i in range(len(s)):
    sn[ord(s[i])-ord('a')]+=1
    tn[ord(t[i])-ord('a')]+=1
print('Yes' if sorted(sn) == sorted(tn) else 'No')

Verdicts: Runtime Error

Accepted
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):

----:---F1  *scratch*      All L1     (Fundamental)-----------------------------
Loading subst-jis...done
S = input()
T = input()

S_list = []
T_list = []
print(S_list)
print(T_list)
alpha = "abcdefghijklmnopqrstuvwxyz"

for i in alpha:
    SS = S.count(i)
    TT = T.count(i)
    if SS and TT > 0:
        S_list.append(SS)
        T_list.append(TT)

if sorted(S_list) != sorted(T_list):
    print('No')
else:
    print('Yes')

S = input()
T = input()

S_list = []
T_list = []
print(S_list)
print(T_list)
alpha = "abcdefghijklmnopqrstuvwxyz"

for i in alpha:
    SS = S.count(i)
    TT = T.count(i)
    if SS > 0:
        S_list.append(SS)
    if TT > 0:
        T_list.append(TT)

if sorted(S_list) != sorted(T_list):
    print('No')
else:
    print('Yes')

S = input()
T = input()

S_list = []
T_list = []
alpha = "abcdefghijklmnopqrstuvwxyz"

for i in alpha:
    SS = S.count(i)
    TT = T.count(i)
    if SS > 0:
        S_list.append(SS)
    if TT > 0:
        T_list.append(TT)

if sorted(S_list) != sorted(T_list):
    print('No')
else:
    print('Yes')

Verdicts: Runtime Error

Wrong Answer

Accepted