Problem:


Score : 300 points

Problem Statement

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.

Constraints

1 \leq |S| \leq 2 \times 10^5

|S| = |T|

S and T consists of lowercase English letters.

Input

Input is given from Standard Input in the following format:

S
T

Output

If S and T can be made equal, print Yes; otherwise, print No.

Sample Input 1

azzel
apple

Sample Output 1

Yes

azzel can be changed to apple, as follows:

Choose e as c_1 and l as c_2. azzel becomes azzle.

Choose z as c_1 and p as c_2. azzle becomes apple.

Sample Input 2

chokudai
redcoder

Sample Output 2

No

No sequences of operation can change chokudai to redcoder.

Sample Input 3

abcdefghijklmnopqrstuvwxyz
ibyhqfrekavclxjstdwgpzmonu

Sample Output 3

Yes



Sample input:
azzel
apple


Sample output:
Yes

Submission status: Runtime Error

Solution code:
one=list(input())
#print(one)
two=list(input())
if one==[] or two==[]
z={}
for num,i in enumerate(one):
    if i not in z:
        z[i]=[num]
    else:
        z[i].append(num)
p={}
for num,i in enumerate(two):
    if i not in p:
        p[i]=[num]
    else:
        p[i].append(num)
w=[]
#print(p)
#print(z)
for k,v in z.items():
    w.append(v)
o=[]
for k,v in p.items():
    o.append(v)
print("Yes") if w==o else print("No")

Submission status: Runtime Error

Solution code:
from math import sqrt, ceil, factorial
from collections import Counter

m = 10**9+7
def is_prime(n):
    if n == 1: return False
    if n == 2: return True
    for i in range(2, ceil(sqrt(n))+1):
        if n % i == 0: return False
    return True

def prime_factorization(n):
    if is_prime(n):return [n]
    factor = []
    f = 2
    while n > 1:
        if n % f == 0:
            factor.append(f)
            n /= f
        else:
            f += 1
    return factor

def comb(n, r):
    a = 1
    for i in range(n-r+1, n+1):
        a *= i
    return a//factorial(r)

N, M = map(int, input().split())
p = prime_factorization(M)
c = Counter(p)
ans = 1
for v in c.values():
    ans *= (comb(v + N - 1, v) % m)
print(ans%m)

Submission status: Runtime Error

Solution code:
s = input()
t = input()

#print(s)
#print(t)

n = len(s)

dic = {}
dic2 = {}


for i in range(n):
    if s[i] in dic:
        if dic[s[i]] != t[i]:
            print("No")
            sys.exit()
            
    else:
        dic[s[i]] = t[i]
            
            
    if t[i] in dic2:
        if dic2[t[i]] != s[i]:
            print("No")
            sys.exit()
            
    else:
        dic2[t[i]] = s[i]
        
print("Yes")

Submission status: Runtime Error

Solution code:
s = list(input())
t = list(input())

#print(s)
#print(t)

n = len(s)

dic = {}
dic2 = {}

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

else:
    for i in range(n):
        if s[i] in dic:
            if dic[s[i]] != t[i]:
                print("No")
                sys.exit()

        else:
            dic[s[i]] = t[i]

        
        if t[i] in dic2:
            if dic2[t[i]] != s[i]:
                print("No")
                sys.exit()

        else:
            dic2[t[i]] = s[i]

print("Yes")

Submission status: Runtime Error

Solution code:
S = input()
T = input()
ans ='Yes'
d = {}
for i, (s, t) in enumerate(zip(S, T)):
    if s == t:
        continue
    if d.get(s) is not None or d.get(t) is not None:
        if d[s] != t or d[t] != s:
            ans = 'No'
            break
    d[s] = t
    d[t] = s
    
print(ans)

Submission status: Runtime Error

Solution code:
s = str(input())
t = str(input())
for i in range(len(s)):
    if i == len(s)-1:
        print('yes')
        break
    if s[i]==t[i]:
        continue
    else:
        index = [j for j,x in enumerate(s) if x == t[i] or x == s[i]]
        print(index)
        if min(index) < i:
            print('No')
            break
        for k in index:
            if s[k] == t[i]:
                s[k] = s[i]
            else:
                s[k] = t[i]

Submission status: Runtime Error

Solution code:
from collections import Counter as C
print(["No", "Yes"][C(C(input()).values()) == C(C(input()).values())])
#I understood

import collections
s = input()
t = input()

S = sorted(list(collections.Counter(s)))
T = sorted(list(collections.Counter(t)))

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

Submission status: Runtime Error

Solution code:
a = input()
b = input()
list1 = [["a", 0 ],["b", 0 ],["c", 0 ],["d", 0 ],["e", 0 ],["f", 0 ],["g", 0 ],["h", 0 ],["i", 0 ],["j", 0 ],
["k", 0 ],["l", 0 ],["m", 0 ],["n", 0 ],["o", 0 ],["p", 0 ],["q", 0 ],["r", 0 ],["s", 0 ],["t", 0 ],
["u", 0 ],["v", 0 ],["w", 0 ],["x", 0 ],["y", 0 ],["z", 0 ]]
list2 = [["a", 0 ],["b", 0 ],["c", 0 ],["d", 0 ],["e", 0 ],["f", 0 ],["g", 0 ],["h", 0 ],["i", 0 ],["j", 0 ],
["k", 0 ],["l", 0 ],["m", 0 ],["n", 0 ],["o", 0 ],["p", 0 ],["q", 0 ],["r", 0 ],["s", 0 ],["t", 0 ],
["u", 0 ],["v", 0 ],["w", 0 ],["x", 0 ],["y", 0 ],["z", 0 ]]
for i in range(len(a)):
    for j in range(26):
        if a[i] == list1[j][0]:
            list1[j][1] += 1
            break
for i in range(len(b)):
    for j in range(26):
        if b[i] == list2[j][0]:
            list2[j][1] += 1
            break
list3 = [list1[i][1] for i in range(26)]
list3.sort()
list4 = [list2[i][1] for i in range(26)]
list4.sort()
flag = True
for i in range(26):
    if list3[i] != list[4]:
        flag = False
if flag:print("Yes")
else:print("No")

Submission status: Runtime Error

Solution code:
m = input()
n = input()
m = list(m)
n = list(n)


def decs():
   j = 0
   for i in range(0,len(m)-2):
       j = i+1
       while j < len(m):
           
           if m[i] == m[j]:
               if n[i] != n[j]:
                   return False
               else:
                   m.remove(j)
                   n.remove(j)
           
           
           
           
           if n[i] == n[j]:
               if m[i] != m[j]:
                   return False
               else:
                   m.remove(j)
                   n.remove(j)
               
           j += 1
           
               
               
   return True
           
   
if decs():
   print("Yes")
else:
   print("No")

Submission status: Runtime Error

Solution code:
import numpy as np
import copy

def main():
    data0 = np.array(list(input()))
    data1 = np.array(list(input()))

    flag = True
    data_tmp = data0
    count = 0
    len_data = len(data0)
    while(count <= len_data):
        if not list(data0):
            break
        count += 1
        c0 = data0[0]
        c1 = data1[0]
        if np.allclose(data0 == c0, data1 == c1)
            data0 = data0[data0 != c0]
            data1 = data1[data1 != c1]
        else:
            flag = False

    if flag:
        print('Yes')
    else:
        print('No')



def swap(data, c0, c1):
    data_tmp = copy.copy(data)
    data_tmp[data == c0] = c1
    data_tmp[data == c1] = c0
    return data_tmp

if __name__ == "__main__":
    main()

Submission status: Runtime Error

Solution code:
from collections import defaultdict

S = input()
T = input()

d = defaultdict(str)

no_flag = False
for i in range(len(S)):
    if S[i] != T[i]:
        if d[S[i]] == T[i]:
            S[i] = T[i]
            pass
        elif d[S[i]] == "" and d[T[i]] == "":
            d[S[i]] = T[i]
            d[T[i]] = S[i]
        else:
            pass

S = sorted(S)
T = sorted(T)
if S == T:
    print("Yes")
else:
    print("No")

Submission status: Runtime Error

Solution code:
S = str(input())
T = str(input())

for i in range(int(len(S) / 2)):
    if S[i] == T[i]:
        continue
    else:
        s_before = S[i]
        S = S.replace(T[i], ',')
        S = S.replace(S[i], T[i])
        S = S.replace(',', s_before)
    if S[len(S) - i] == T[len(S) - i]:
        continue
    else:
        s_before = S[len(S) - i]
        S = S.replace(T[len(S) - i], ',')
        S = S.replace(S[len(S) - i], T[len(S) - i])
        S = S.replace(',', s_before)

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

Submission status: Runtime Error

Solution code:
S=input()
T=input()
     
s=list(S)
t=list(T)
     
a=set(s)
b=set(t)
     
A=0
B=0
     
c=len(a)
     
for i in range (c):
    d= S.count("a[i]")
    A +=d＊＊3
     
for i in range (c):
    e= S.count("b[i]")
    B +=e＊＊3
     
if len(s)-len(a) == len (t)-len(b) and A==B:
    print("Yes")
else:
    print("No")

Submission status: Runtime Error

Solution code:
S = list(input())
T = list(input())

for _ in range(1000):
    for s,t in zip(S,T):
        if s != t:
            target = s
            goal = t
            break
    S = [target if s == goal else s.replace(target,goal) for s in S]
    
if S == T:
    print("Yes")
else:
    print("No")

Submission status: Runtime Error

Solution code:
S=input()
T=input()
     
s=list(S)
t=list(T)
     
a=set(s)
b=set(t)
     
A=0
B=0
     
 c=len(a)
     
for i in range (c):
    d= S.count("a[i]")
    A +=d＊＊3
     
for i in range (c):
    e= S.count("b[i]")
    B +=e＊＊3
     
if len(s)-len(a) == len (t)-len(b) and A==B:
    print("Yes")
else:
    print("No")

Submission status: Runtime Error

Solution code:
S = input()
T = input()
# print()
if len(S)>=10**5+9*10**4:
    print("Yes")
elif len(S)>= 10**5+8**4:
    print(‘No’)
else:
    for i in range(len(S)):
        if S[i] != T[i]:
            S = S.translate(str.maketrans({S[i]:T[i],T[i]:S[i]}))
            # S=S.replace(S[i],T[i])
    if S==T:
        print("Yes")
    else:
        print("No")

Submission status: Runtime Error

Solution code:
S = input()
T = input()
# print()
if len(S)>=10**5+9*10**4:
    print("Yes")
elif len(S)>= 10**5+8**4:
    print(“No”)
else:
    for i in range(len(S)):
        if S[i] != T[i]:
            S = S.translate(str.maketrans({S[i]:T[i],T[i]:S[i]}))
            # S=S.replace(S[i],T[i])
    if S==T:
        print("Yes")
    else:
        print("No")

Submission status: Runtime Error

Solution code:
import sys
import socket

hostname = socket.gethostname()

if hostname == 'F551C':
    sys.stdin = open('c1.in')


def read_int_list():
    return list(map(int, input().split()))


def read_str_list():
    return input().split()


def read_int():
    return int(input())


def read_str():
    return input()


def main():
    S = read_str()
    T = read_str()
    n = len(S)
    res = 'Yes'
    A = [0] * n
    B = [0] * n
    vu = {}
    for i in range(n):
        if S[i] in vu:
            A[i] = vu[S[i]]
        else:
            vu[S[i]] = i
            A[i] = vu[S[i]]

    vu = {}
    for i in range(n):
        if T[i] in vu:
            T[i] = vu[T[i]]
        else:
            vu[T[i]] = i
            B[i] = vu[T[i]]

    if A != B:
        res = 'No'

    # for i in range(n):
    #     for j in range(n):
    #         if S[i] != S[j] and T[i] == T[j]:
    #             res = 'No'
    #         if S[i] == S[j] and T[i] != T[j]:
    #             res = 'No'
    print(res)


main()

Submission status: Runtime Error

Solution code:
S=list(input())
T=list(input())
N=len(S)
l=[]
i=0

for i in range(N):
  if i==N-1:
    break
  elif S[i] in S[i+1::]:
    l.append([i,S[i+1::].index(S[i])])
  else:
    continue
  


l2=[]  
for i in range(N):
  if i==N-1:
    break
  elif T[i] in T[i+1::]:
    l.append([i,T[i+1::].index(S[T])])
  else:
    continue

  
if l==l2:
  print('Yes')
else:
  print('No')

Submission status: Runtime Error

Solution code:
import sys
s=input()
t=input()

def c(a,b,s,t):
    li=""
    j=0
    for i in s:
        if i==a:
            li+=b
            if t[j]!=b:
                print("No")
                sys.exit()
        elif i==b:
            li+=a
        else:
            li+=i
        j+=1
    return li
    

for i in range(len(t)):
    if s[i]!=t[i]:
        l.append(t[i])
        s=c(s[i],t[i],s,t)
    
        

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

Submission status: Runtime Error

Solution code:
S=list(input())
T=list(input())
N=len(S)
l=[]
i=0

for i in range(N):
  if i==N:
    break
  elif S[i] in S[i+1::]:
    l.append([i,S[i+1::].index(S[i])])
  else:
    continue
  


l2=[]  
for i in range(N):
  if i==N:
    break
  elif T[i] in T[i+1::]:
    l.append([i,T[i+1::].index(S[T])])
  else:
    continue

  
if l==l2:
  print('Yes')
else:
  print('No')

Submission status: Runtime Error

Solution code:
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")

Submission status: Runtime Error

Solution code:
S=list(input())
T=list(input())
N=len(S)
l=[]
i=0

for i in range(N):
  if i==N
    break
  elif S[i] in S[i+1::]:
    l.append([i,S[i+1::].index(S[i])])
  else:
    continue
  


l2=[]  
for i in range(N):
  if i==N:
    break
  elif T[i] in T[i+1::]:
    l.append([i,T[i+1::].index(S[T])])
  else:
    continue

  
if l==l2:
  print('Yes')
else:
  print('No')

Submission status: Runtime Error

Solution code:
s=list(input())
t=list(input())
ns=[0 for i in range(len(s))]
nt=[0 for i in range(len(s))]
us=[s[0]]
ut=[t[0]]
cs=0
ct=0
for i in range(1,len(s)):
    if s[i] in us:
        ns[i]=ns[us.index(s[i])]
    else:
        cs+=1
        ns[i]=cs
        us.append(s[i])
for i in range(1,len(t)):
    if t[i] in ut:
        nt[i]=nt[ut.index(t[i])]
    else:
        ct+=1
        nt[i]=ct
        ut.append(t[i])
dl=[]
for i in range(dl):
    if s[i]!=t[i]:
        if s[i] not in dl:
            dl.append(s[i])
if ns==nt:
    if len(dl)<=25: 
        print('Yes')
    else:
        print('No')
else:
    print('No')

Submission status: Runtime Error

Solution code:
S=list(input())
T=list(input())
N=len(S)
l=[]
i=0

for i in range(N):
  if S[i] in S[i+1::]:
    l.append([i,S[i+1::].index(S[i])])
  else:
    continue
  


l2=[]  
for i in range(N):
  if T[i] in T[i+1::]:
    l.append([i,T[i+1::].index(S[T])])
  else:
    continue

  
if l==l2:
  print('Yes')
else:
  print('No')

Submission status: Runtime Error

Solution code:
s = list(input().split())
t = list(input().split())

n = len(s)
x = [0]*n
for i in range(n-1):
    if s[i] == s[i+1]: 
        x[i] += 1
    else:
        break

y = [0]*n
for i in range(n-1):
    if s[i] == s[i+1]: 
        x[i] += 1
    else:
        break

S =collections.Counter(s)
T =collections.Counter(t)

S1 = S.values()
T1 = S.values()

if x == y and sorted(S1) == sorted(T1):
    print('Yes')
else:
    print('No')

Submission status: Runtime Error

Solution code:
def main():
    """
    英小文字のみからなる文字列 S, T
    文字列 Sに対して、次の操作を何度でも行うことができます。

    操作
        2つの異なる英小文字 c1, c2を選び、
        Sに含まれる全ての 
        c1 を c2に、
        c2 を c1に、置き換える

    0回以上操作を行って、S を Tに一致させられるか判定

    1 <= |S| = |T| <= 2 * 10^5
    """
    S = input()
    T = input()

    ans = f(S, T)
    print(ans)


if True:
    import pytest

    @pytest.mark.randomize(S=str, T=str,
                           min_length=10, max_length=10,
                           str_attrs=("ascii_lowercase",))
    def test_f(S, T):

        assert f(S, T)


def f(S, T):
    """
    26文字存在しないとき
    S: abc
    T: def
        a -> d にしたい
        dbc
        dはSに存在しないので好きに変えられる, でよいか

    S: abc
    T: ddf
        a -> d: dbc
        b -> d: dが存在する
        bを存在しないものに変える: dzc, 状況は変わらない
        a,b入れ替えても意味がない
        a->x, b->x and x->b: bxc, 状況は変わらない

        割当がかぶっていると無理っぽい

    仮に3文字しか種類がない
    S: abc
    T: cab
        c->a, a->c: cba
        b->a, a->b: cab
    """
    import string
    ds = {c: set() for c in string.ascii_lowercase}
    dt = {c: set() for c in string.ascii_lowercase}
    for c1, c2 in zip(S, T):
        ds[c2].add(c1)
        dt[c1].add(c2)

    for c in string.ascii_lowercase:
        if len(ds[c]) >= 2 or len(dt[c]) >= 2:
            return "No"

    return "Yes"


if __name__ == '__main__':
    main()

Submission status: Runtime Error

Solution code:
list(input())
t=list(input())
a=[0]*27
for i in range(len(s)):
  if a[ord(s[i])-96]==0:
    a[ord(s[i])-96]=ord(t[i])-96
  elif a[ord(s[i])-96]==ord(t[i])-96:
    continue
  else:
    print("No")
    exit()
print("Yes")

Submission status: Runtime Error

Solution code:
T = input()
N = len(S)
text = [' '] * (N+1)
text[0] = S
for i in range(N):
  s = S[i]
  t = T[i]
  text[i+1] = text[i].replace(s, 'X').replace(t, 'Y').replace('X', t).replace('Y', s)
if text[N] == T:
  print('Yes')
else:
  print('No')

Submission status: Runtime Error

Solution code:
s=list(map(int,input().split()))
t=list(map(int,input().split()))
a=[0]*26
for i in range(len(s)):
  if a[ord(s[i])]==0:
    a[ord(s[i])]=ord(t[i])
  elif a[ord(s[i])]==ord(t[i]):
    continue
  else:
    print("No")
    exit()
print("Yes")

Submission status: Runtime Error

Solution code:
s=list(map(int,input().split()))
t=list(map(int,input().split()))
a=[0]*26
for i in range(len(s)):
  if a[ord(s[i])]==0:
    a[ord(s[i])]=ord(t[i])
  elif a[ord(s[i])]==ord(t[i]):
    continue
  else:
    print("No")
    exit()

Submission status: Runtime Error

Solution code:
from collections import Counter

S = Counter(list(input()))
T = Counter(list(input()))
s,t = list(S.values()),list(T.values())
print(["No", "Yes"][(s.sort() == t.sort() or  len(s) % 2 != 0]))

Submission status: Runtime Error

Solution code:
from collections import Counter

S = Counter(list(input()))
T = Counter(list(input()))
s,t = list(S.values()),list(T.values())
print(["No", "Yes"][(s.sort() == t.sort() or  len(s) % 2 != 0])

Submission status: Runtime Error

Solution code:

xa = list(input())

ya = list(input())

an=[]

f=1

allxy=[]
allyx=[]

for i in range(len(xa)):
    if xa[i]!=ya[i]:
        allxy.append([xa[i], ya[i]])
        allyx.append([ya[i], xa[i]])

all2=list(map(list, set(map(tuple, allxy))))
all2.sort()
all3=list(map(list, set(map(tuple, allyx))))
all3.sort()

for i in range(len(all2)-1):
    if all2[i][0]==all2[i+1][0]:
        f=-1
        break
    elif all3[i][0]==all3[i+1][0]:
        f=-1
        break
else:
    if all2[i][0]==all2[i+1][0]:
        f=-1
    elif all3[i][0]==all3[i+1][0]:
        f=-1
    
        
if f>0:
    print("Yes")
else:
    print("No")

Submission status: Runtime Error

Solution code:
mn = input()
m,n = mn.split()

def decs():
   for i in range(0,len(m)-1):
       for j in range(1,len(m)-1):
           if m[i] == m[j]:
               if n[i] != n[j]:
                   return False
           if n[i] == n[j]:
               if m[i] != m[j]:
                   return False
               
               
   return True
           
   
if decs():
   print("Yes")
else:
   print("No")

Submission status: Runtime Error

Solution code:
s = input()
t = input()

a = set([*s])
b = set([*t])
if len(a) == len(b):
    print("Yes")
else:
    print("No")

Submission status: Runtime Error

Solution code:
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')

Submission status: Runtime Error

Solution code:
S = list(input())
T = list(input())
n = len(S)
result = False
if len(T) != n:
    result = True
SA = []
for i in range(n):
    SA.append(int(S.count(S[i])))
TA = []
for i in range(n):
    TA.append(int(T.count(T[i])))
SB =list(SA.sort())
TB =list(TA.sort())
for i in range(n):
    if SB[i] != TB[i]:
        result = True
if result:
    print("No")
else:
    print("Yes")

Submission status: Runtime Error

Solution code:
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")

Submission status: Runtime Error

Solution code:

import math


def main():
    a = list(input())
    b = list(input())
    dica = {}
    dicb = {}
    dif = 0
    alpha = list("abcdefghijklmnopqrstuvwxyz")
    for aa,bb in zip(a,b):
        if aa != bb:
            if bb not in dica:  
                dica[bb] = aa
            if aa not in dicb:
                dicb[aa] =bb
        
            if dica[bb] != aa or dicb[aa] != bb:            
                print("No")
                return 0
        
            # if aa not in dica:
            #     dica[aa] = bb
            # if bb not in dicb:
            #     dicb[bb] = aa
            
    if dica[b[-1]] != a[-1] or dicb[a[-1]] != b[-1]:            
        print("No")
        return 0
    
    print("Yes")
    
    # for c in alpha:
    #     dica[c] = 0
    #     dicb[c] = 0
    # for temp in a:
    #     dica[temp] +=1
    # for temp in b:
    #     dicb[temp] +=1
    # for c in alpha:
    #     dif += (dica[c]-dicb[c])
    
    

if __name__ == '__main__':
    main()

Submission status: Runtime Error

Solution code:
s=input().strip()
t=input().strip()
s_list=[]
t_list=[]
for char in s:
    s_list.append(char)
for char in t:
    t_list.append(char)
s_collection=collections.Counter(s_list)
t_collection=collections.Counter(t_list)
s_countlist=[]
t_countlist=[]
for entry in s_collection.values():
    s_countlist.append(entry)
for entry in t_collection.values():
    t_countlist.append(entry)
s_countlist.sort()
t_countlist.sort()
if s_countlist == t_countlist:
    print("Yes")
else:
    print("No")

Submission status: Runtime Error

Solution code:

import math


def main():
    a = list(input())
    b = list(input())
    dica = {}
    dicb = {}
    dif = 0
    alpha = list("abcdefghijklmnopqrstuvwxyz")
    for aa,bb in zip(a,b):
        if aa != bb:
            if bb not in dica:  
                dica[bb] = aa
            if aa not in dicb:
                dicb[aa] =bb
        
            if dica[bb] != aa or dicb[aa] != bb:            
                print("No")
                return 0
        
            # if aa not in dica:
            #     dica[aa] = bb
            # if bb not in dicb:
            #     dicb[bb] = aa
            
    if dica[b[-1]] != a[-1] or dicb[a[-1]] != b[-1]:            
                print("No")
                return 0
            
    print("Yes")
    
    # for c in alpha:
    #     dica[c] = 0
    #     dicb[c] = 0
    # for temp in a:
    #     dica[temp] +=1
    # for temp in b:
    #     dicb[temp] +=1
    # for c in alpha:
    #     dif += (dica[c]-dicb[c])
    
    

if __name__ == '__main__':
    main()

Submission status: Runtime Error

Solution code:

import math


def main():
    a = list(input())
    b = list(input())
    dica = {}
    dicb = {}
    dif = 0
    alpha = list("abcdefghijklmnopqrstuvwxyz")
    for aa,bb in zip(a,b):
        if aa != bb:
            if bb not in dica:  
                dica[bb] = aa
            if aa not in dicb:
                dicb[aa] =bb
        
            if dica[bb] != aa or dicb[aa] != bb:            
                print("No")
                return 0
        
            # if aa not in dica:
            #     dica[aa] = bb
            # if bb not in dicb:
            #     dicb[bb] = aa
            
    if dica[b[-1]] != aa or dicb[a[-1]] != bb:            
                print("No")
                return 0
            
    print("Yes")
    
    # for c in alpha:
    #     dica[c] = 0
    #     dicb[c] = 0
    # for temp in a:
    #     dica[temp] +=1
    # for temp in b:
    #     dicb[temp] +=1
    # for c in alpha:
    #     dif += (dica[c]-dicb[c])
    
    

if __name__ == '__main__':
    main()

Submission status: Runtime Error

Solution code:

import math


def main():
    a = list(input())
    b = list(input())
    dica = {}
    dicb = {}
    dif = 0
    alpha = list("abcdefghijklmnopqrstuvwxyz")
    for aa,bb in zip(a,b):
        if aa != bb:
            if bb not in dica:  
                dica[bb] = aa
            if aa not in dicb:
                dicb[aa] =bb
        
            if dica[bb] != aa or dicb[aa] != bb:            
                print("No")
                return 0
        
            # if aa not in dica:
            #     dica[aa] = bb
            # if bb not in dicb:
            #     dicb[bb] = aa
            
    if dica[bb] != aa or dicb[aa] != bb:            
                print("No")
                return 0
            
    print("Yes")
    
    # for c in alpha:
    #     dica[c] = 0
    #     dicb[c] = 0
    # for temp in a:
    #     dica[temp] +=1
    # for temp in b:
    #     dicb[temp] +=1
    # for c in alpha:
    #     dif += (dica[c]-dicb[c])
    
    

if __name__ == '__main__':
    main()

Submission status: Runtime Error

Solution code:
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')

Submission status: Runtime Error

Solution code:
def main(S, T):
    cs = dict()

    for i, s in enumerate(S):
        t = T[i]
        if s != t:
            if t not in cs:
                cs[t] = s
            elif cs[t] == s:
                continue
            else:
                return "No"
    return "Yes"

if __name__ == "__main__":
    #assert main("azzel", "apple") == "Yes"
    #assert main("abcdefghijklmnopqrstuvwxyz", "ibyhqfrekavclxjstdwgpzmonu") == "Yes"
    #assert main("chokudai", "redcoder") == "No"
    S = input()
    T = input()
    print(main())

Submission status: Runtime Error

Solution code:
def main(S, T):
    cs = dict()

    for i, s in enumerate(S):
        t = T[i]
        if s != t:
            if t not in cs:
                cs[t] = s
            elif cs[t] == s:
                continue
            else:
                return "No"
    return "Yes"

if __name__ == "__main__":

    S = input()
    T = input()
    print(main())

Submission status: Runtime Error

Solution code:
n, m, x, y = [int(i) for i in input().split(" ")]
x_range = [int(i) for i in input().split(" ")]
y_range = [int(i) for i in input().split(" ")]
war = True
for z in range(x, y + 1):
    if x < z <= y and max(x_range) < z <= max(y_range[:m]):
        war = False
print("War" if war else "No War")

Submission status: Runtime Error

Solution code:
import numpy as np

s = list(str(input()))
t = list(str(input()))

_, s_c = np.unique(s, return_counts=True)
_, t_c = np.unique(t, return_counts=True)
if np.array_equal(s_c, t_c):
	print('Yes')
else:
	print('No')

Submission status: Runtime Error

Solution code:
print(["No", "Yes"][Counter(Counter(input()).values()) == Counter(Counter(input()).values())])