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:
str1 = list(input())
str2 = list(input())

n = len(str1)

str1 = ''.join(str1)
str2 = ''.join(str2) 
if (str1 == str2):
    print("No")
    exit(0)
for i in range(n):
    if str1[i]==str2[i]:
        continue
    for j in range(i+1,n):
        if str1[j]==str1[i]:
            tmp = str2[i]
            str2[i] = str1[j]
            str1[j] = tmp
            break
        elif str2[j] == str1[i]:
            tmp = str2[j]
            str2[j] = str1[i+1]
            str1[i+1] = str2[i]
            str2[i] = tmp
            break
str1 = ''.join(str1)
str2 = ''.join(str2) 

if(str1 == str2):
    print("Yes")
else:
    print("No")

Submission status: Runtime Error

Solution code:
n, x = map(int, input().split())
l = list(map(int, input().split()))

def gcd(x, y):
    while (y != 0):
        x, y = y, x%y

    return x

diff = []

for j in l:
    diff.append(abs(j - x))

ans = diff[0]

for d in range(d[1:]):
    ans = gcd(ans, d)

print(ans)

Submission status: Runtime Error

Solution code:
n, x = map(int, input().split())
l = list(map(int, input().split()))

def gcd(x, y):
    while (y != 0):
        x, y = y, x%y

    return x

diff = []

for j in l:
    diff.append(abs(j - x))

ans = diff[0]

for d in range(diff[1:]):
    ans = gcd(ans, d)

print(ans)

Submission status: Runtime Error

Solution code:
s1 = raw_input()
s2 = raw_input()

print(sorted(s1))
print(sorted(s2))

dict1 = {}
dict2 = {}

for i in s1:
	dict1[i] = dict1.get(i,0)+1
for i in s2:
	dict2[i] = dict2.get(i,0)+1

values1 = sorted(dict1.values())
values2 = sorted(dict2.values())

for i in range(len(values1)):
	if values1[i]!=values2[i]:
		print("No")
print("Yes")

Submission status: Runtime Error

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

checked_s=[0]*26

for i in range(len(S)):
    if S[i] != T[i]:
        if T[i] in S:
            S = S.translate(str.maketrans({S[i]:T[i], T[i]: S[i]}))
        elif checked_s[i] == 0:
            S = S.replace(S[i], T[i])
            
if S==T:
    print("Yes")
else:
    print("No")

Submission status: Runtime Error

Solution code:

def get_input(inp):
    li = inp.split("\n")

    def inner():
        return li.pop(0)
    return inner

INPUT = """azzel
apple
"""
input = get_input(INPUT)

#######################################################
a = input()
b = input()
k = []
l = []
np=0
nq=0
for i in range(0,len(a)):
    if a[i] not in k:
        k.append(a[i])
        np+=1
    if b[i] not in l:
        l.append(b[i])
        nq+=1
    if i != 0:
        if not (k.index(a[i])==l.index(b[i]) and ((a[i-1]==a[i] and b[i-1] == b[i]) or ( a[i-1] != a[i] and b[i-1]!= b[i])):
            np*=0
if np == nq:
    print("Yes")
else:
    print("No")

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
s=sorted(map(list(input()).count,set(s)))
t=sorted(map(list(input()).count,set(t)))
print("Yes" if s==t else "No")

Submission status: Runtime Error

Solution code:
mod = 10 ** 9 + 7
n, m = map(int, input().split())

f = []
p = 2
while p * p <= m:
    if m % p != 0:
        p += 1
        continue
    c = 0
    while m % p == 0:
        c += 1
        m //= p
    f.append(c)
    p += 1
if m != 1:
    f.append(1)


def comb(a, b):
    ret = 1
    r = min(b, a-b)
    for i in range(a-r+1, a+1):
        ret *= i
    for j in range(1, r+1):
        ret //= j
    return (int)(ret)


ans = 1
for i in f:
    c = 1
    for j in range(i):
        c = c * (n+j) // (j+1)
    ans *= c
print(ans % mod)

Submission status: Runtime Error

Solution code:
from collctions import Counter

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

Scount = Counter(S).values()
Tcount = Counter(T).values()



if sorted(Scount) == sorted(Tcount):
    ans = 'Yes' 
else:
    ans = 'No'

print(ans)

Submission status: Runtime Error

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

Sn = [ord(i)-ord("a") for i in S]
Tn = [ord(i)-ord("a") for i in T]
sub1 = [-1]*26
sub2 = [-1]*26

for i in range(len(S)):
    if sub1[Sn[i]] == -1 or sub2[Tn[i]] == -1:
        if sub1[Sn[i]] == -1:
            sub1[Sn[i]] = Tn[i]
        if sub2[Tn[i]] == -1:
            sub2[Tn[i]] = Sn[i]
    if sub1[Sn[i]] != Tn[i] or sub2[Tn[i]] != Sn[i]:
            print("No")
            break
else:
    print("Yes")

Submission status: Runtime Error

Solution code:
#include <random>
#include <string>
#include <iostream>
using namespace std;
string s, t;
int main() {
	cin >> s >> t;
	mt19937 mt(1812191250);
	int N = s.size();
	uniform_int_distribution<int> p(0, N - 1);
	bool ok = true;
	for (int i = 0; i < 10000000; ++i) {
		int a = p(mt), b = p(mt);
		if ((s[a] == s[b]) != (t[a] == t[b])) {
			ok = false;
			break;
		}
	}
	cout << (ok ? "Yes" : "No") << endl;
	return 0;
}

Submission status: Runtime Error

Solution code:
s = input()
t = input()
dic1 = {}
dic2 = {}
for i in range(len(s)):
    if dic1.get(s[i]) == None:
        dic1[s[i]] = t[i]
    elif dic1[s[i]] != t[i] 
        print("No")
        exit()
    if dic2.get(t[i]) == None:
        dic2[t[i]] = s[i]
    elif dic2[t[i]] != s[i]:
        print("No")
        exit()
print("Yes")

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
def ctonum(c):
	alp = "qwertyuiopasdfghjklzxcvbnm"
	for i in range(len(alp)):
		if c == alp[i]:
			return i

countS=[0 for i in range(100)]
countT=[0 for i in range(100)]

S=input()
T=input()

for i in range(len(S)):
	countS[ctonum[S(i)]]+=1
	countT[ctonum[T(i)]]+=1
	
countS.sort()
countT.sort()

if countS==countT:
	print("Yes")
else:
	print("No")

Submission status: Runtime Error

Solution code:
def ctonum(c):
	alp = "qwertyuiopasdfghjklzxcvbnm"
	for i in range(len(alp)):
		if c == alp[i]:
			return i

countS=[0 for i in range(100)]
countT=[0 for i in range(100)]

S=input()
T=input()

for i in range(len(S)):
	countS[ctonum[S[i]]]+=1
	countT[ctonum[T[i]]]+=1
	
countS.sort()
countT.sort()

if countS==countT:
	print("Yes")
else:
	print("No")

Submission status: Runtime Error

Solution code:
def ctonum(c):
	alp="qwertyuiopasdfghjklzxcvbnm"
	for i in range(len(alp)):
		if c == alp[i]:
			return i

countS=[0 for i in range(100)]
countT=countS

S,T=input(),input()

for i in range(len(S)):
	countS[ctonum[S[i]]]+=1
	countT[ctonum[T[i]]]+=1
	
countS.sort()
countT.sort()

if countS==countT:
	print("Yes")
else:
	print("No")

Submission status: Runtime Error

Solution code:
def ctonum(c):
	alp="qwertyuiopasdfghjklzxcvbnm"
	for i in range(len(alp)):
		if yay == alp[i]:
			return i

countS=[0 for i in range(100)]
countT=countS

S,T=input(),input()

for i in range(len(S)):
	countS[ctonum[S[i]]]+=1
	countT[ctonum[T[i]]]+=1
	
countS.sort()
countT.sort()

if countS==countT:
	print("Yes")
else:
	print("No")

Submission status: Runtime Error

Solution code:
def ctonum(c):
	alp="qwertyuiopasdfghjklzxcvbnm"
	for i in len(alp):
		if yay == alp[i]:
			return i

countS=[0 for i in range(100)]
countT=countS

S,T=input(),input()

for i in range(len(S)):
	countS[ctonum[S[i]]]+=1
	countT[ctonum[T[i]]]+=1
	
countS.sort()
countT.sort()

if countS==countT:
	print("Yes")
else:
	print("No")

Submission status: Runtime Error

Solution code:
ss = str(input())
t  = str(input())

for i in range(len(ss)):

    if ss == t :
        print("Yes")
        exit(0)

    s  = list(ss)

    if s[i] != t[i]:
        c1 = s[i]
        c2 = t[i]
       
        ss = ss.replace(c1 ,"-")
        ss = ss.replace(c2 ,c1 )
        ss = ss.replace("-",c2 )
        print(ss)

print("No")

Submission status: Runtime Error

Solution code:
s1 = raw_input()
s2 = raw_input()
sl1 = []
sl2 = []
for i in s1:
	if i not in sl1:
		sl1.append(i)

for i in s2:
	if i not in sl2:
		sl2.append(i)

count = 0
for i in xrange(len(sl1)):
	if sl1[i] != sl2[i]:
		count += 1
if count > 2:
	print "No"
else:
	print "Yes"

Submission status: Runtime Error

Solution code:
S=input()
T=input()
s=list(S)
t=list(T)
ss=[]
tt=[]
for i in range('a',chr(ord('z')+1)):
    a=s.count(i)
    ss.append(a)
    b=t.count(i)
    tt.append(b)
ss.sort()
tt.sort()
if ss==tt:
    print("Yes")
else:
    print("No")

Submission status: Runtime Error

Solution code:
S=input()
T=input()
s=list(S)
t=list(T)
ss=[]
tt=[]
for i in range(‘a’,chr(ord('z')+1)):
    a=s.count(i)
    ss.append(a)
    b=t.count(i)
    tt.append(b)
ss.sort()
tt.sort()
if ss==tt:
    print("Yes")
else:
    print("No")

Submission status: Runtime Error

Solution code:
s=input()
t=input()
a,b={},{}
cnt=1

for i in range(len(s)):
    if s[i] not in a and t[i] not in b:
        a[s[i]]=cnt
        b[t[i]]=cnt
        ant+=1
    elif s[i] in a and t[i] in b and (a[s[i]]==b[t[i]]):
        pass
    else
        print("No")
        exit()
print("Yes")

Submission status: Runtime Error

Solution code:
S = input()
T = input()
s = list(S)
t = list(T)
a = len(s)
i = 0
while i < a:
    for j in range(a-1):
        if ((t[i] == t[j]) and (s[i] != s[j])) or ((s[i] == s[j]) and (t[i] != t[j]):
            print("No")
            exit()
    i = i+1
    if i == a:
        print("Yes")
        break

Submission status: Runtime Error

Solution code:
def main():
    S = input()
    T = input()

    DICT = {}

    for ch_s, ch_t in zip(S, T):
        #print(ch_s, ch_t)
        if ch_s in DICT.keys():
            #print('swap')
            ch_s = DICT[ch_s]

        if ch_t in DICT.values():
            #print(DICT)
            print(ch_s, ch_t, DICT[ch_t])
            if DICT[ch_t] != ch_t:
                print('No')
                return
        DICT[ch_s] = ch_t
    print('Yes')
    return


main()

Submission status: Runtime Error

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

Rs = {}
Rt = {}
for i in range(len(S)):
    if S[i] in Rs.keys:
        if Rs[S[i]] != T[i]:
             print("No")
             exit()
    else:
        Rs[S[i]] = T[i]

    if T[i] in Rt.keys:
        if Rt[T[i]] != S[i]:
            print("No")
            exit()
    else:
        Rt[T[i]] = S[i]
print("Yes")

Submission status: Runtime Error

Solution code:
s = list(input())
t = list(input())
pair = []
li =[]
ans = "Yes"

for i in range(len(s)):
    if [s[i],t[i]] in li:
        pass
    else:
        li.append([s[i],t[i]])

def check2(pair,i,li):
    for j in range(len(pair)):
        if (li[i][0]==pair[j][0] and li[i][1]!=pair[j][1])or(li[i][0]!=pair[j][0] and li[i][1]==pair[j][1]):
            return False
    return True

for i in range(len(s)):
    if check2(pair,i,li):
        pair.append([li[i][0],li[i][1]])
    else:
        ans = "No"
        break

print(ans)

Submission status: Runtime Error

Solution code:
S = input()
T = input()
cnt = []
ans = 1
fis1 = [index for index, word in enumerate(S) if S[i] == S[0]]
fis2 = [index for index, word in enumerate(T) if T[i] == T[0]]

if fis1 != fis2:
    ans = 0
else:
    for i in range(len(S)):
        if i not in fis1:
            kensa1 = [index for index, word in enumerate(S) if S[i] == word]
            kensa2 = [index for index, word in enumerate(T) if T[i] == word]
            if kensa1 != kensa2:
                ans = 0
                break
            else:
                fis1.append(kensa1)
    
print('Yes' if ans == 1 else 'No')

Submission status: Runtime Error

Solution code:
s = input()
t = input()
while s != "":
  x = s[0]
  y = t[0]
  for i in range(len(s)):
    if (s[i] == "x" and t[i] != "y") or (s[i] != "x" and t[i] == "y"):
      print("No")
      exit()
  s = s.replace(x,"")
  t = t.replace(y,"")
print("Yes")

Submission status: Runtime Error

Solution code:
#! /usr/bin/env python
# -*- coding: utf-8 -*-
# vim:fenc=utf-8
#

"""
RC110C
"""


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

def exchange(a,b,c):
    if a != b and a!=c:
        return(a)
    elif a == b:
        return(c)
    elif a == c:
        return(b)

ans = 'Yes'

seen = set()
for i in range(n):
    sl = s.pop()
    tl = t.pop()
    if sl == tl:
        seen.add(sl)
    elif sl != tl and not tl in seen and not sl in seen:
        s = list(map(lambda a: exchange(a,sl,tl),s))
        seen.add(tl)
    else:
        ans = 'No'
        break
    print(s)

print(ans)

Submission status: Runtime Error

Solution code:
flag = True
egal = False
count = 0
S,T = raw_input().lower().split()
Ss = set(S)
Ts = set(T)
dset = Ss - Ts
dset2 = Ts - Ss
if len(dset) < 3 or len(dset2) < 3:
    flag = False
elif len(dset) == 0 or len(dset2) == 0:
    egal = True
else:
    c1, c2 = dset
    c3, c4 = dset2
    Sl = list(S)
    Tl = list(T)
    for s in S:
        if s == c1:
            S = S.replace(s, c3)
            count += 1
        if s == c2:
            S = S.replace(s, c4)
            count += 1
if S == T and count < 4 and flag:
    print('Yes')
if egal == True:
    print('Yes')
else:
    print('No')

Submission status: Runtime Error

Solution code:
flag = True
egal = False
count = 0
S = raw_input().lower()
T = raw_input().lower()
Ss = set(S)
Ts = set(T)
dset = Ss - Ts
dset2 = Ts - Ss
if len(dset) < 3 or len(dset2) < 3:
    flag = False
elif len(dset) == 0 or len(dset2) == 0:
    egal = True
else:
    c1, c2 = dset
    c3, c4 = dset2
    Sl = list(S)
    Tl = list(T)
    for s in S:
        if s == c1:
            S = S.replace(s, c3)
            count += 1
        if s == c2:
            S = S.replace(s, c4)
            count += 1
if S == T and count < 4 and flag:
    print('Yes')
if egal == True:
    print('Yes')
else:
    print('No')

Submission status: Runtime Error

Solution code:
import collections

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

cs = collections.Counter(s)
ct = collections.Counter(t)

slist = cs.values()
tlist = ct.values()

slist.sort()
tlist.sort()

if slist == tlist:
    print("Yes")
else:
    print("No")

Submission status: Runtime Error

Solution code:
from collections import Counter

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

cs = Counter(s)
ct = Counter(t)

slist = list(cs.value())
tlist = list(cs.value())

slist.sort()
tlist.sort()

if slist == tlist:
    print("Yes")
else:
    print("No")

Submission status: Runtime Error

Solution code:
from collections import Counter

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

cs = Counter(s)
ct = Counter(t)

slist = cs.value()
tlist = cs.value()

slist.sort()
tlist.sort()

if slist == tlist:
    print("Yes")
else:
    print("No")

Submission status: Runtime Error

Solution code:
def solve():
    alpha = "abcdefghijklmnopqrstuvwxyz"
    inp1, inp2 = input(), input()
    sz = dict(zip(list(alpha), [0] * 26))
    tz = dict(zip(list(alpha), [0] * 26))
    siz = dict(
        zip(list(alpha), [[0 for i in range(10 ** 5)] for _ in range(26)]))
    tiz = dict(
        zip(list(alpha), [[0 for i in range(10 ** 5)] for _ in range(26)]))
    for i in range(len(inp1)):
        sz[inp1[i]] += 1
        tz[inp2[i]] += 1
        siz[inp1[i]][i] = i
        tiz[inp2[i]][i] = i
        if (sz[inp1[i]] != tz[inp2[i]]):
            print("No")
            return
    for e in alpha:
        if set(siz[e]) ^ set(tiz[e]):
            print("No")
            return
    print("Yes")


solve()

Submission status: Runtime Error

Solution code:
def solve():
    alpha = "abcdefghijklmnopqrstuvwxyz"
    inp1, inp2 = input(), input()
    sz = dict(zip(list(alpha), [0] * 26))
    tz = dict(zip(list(alpha), [0] * 26))
    siz = dict(
        zip(list(alpha), [[0 for i in range(10 ** 5)] for _ in range(26)]))
    tiz = dict(
        zip(list(alpha), [[0 for i in range(10 ** 5)] for _ in range(26)]))
    for i in range(len(inp1)):
        sz[inp1[i]] += 1
        tz[inp2[i]] += 1
        siz[inp1[i]][i] = i
        tiz[inp1[i]][i] = i
        if (sz[inp1[i]] != tz[inp2[i]]):
            print("No")
            return
    for e in alpha:
        if set(siz[e]) - set(tiz[e]):
            print("No")
            return
    print("Yes")


solve()

Submission status: Runtime Error

Solution code:
S = input()
T = input()
f = [-1 for _ in range(130)]
g = [-1 for _ in range(130)]
ans = "Yes"
for i in len(S):
  s = ord(S[i])
  t = ord(T[i])
  if f[s] == -1:
    f[s] = t
  else:
    if f[s] != t:
      ans = "No"
  if g[t] == -1:
    g[t] = s
  else:
    if g[t] != s:
      ans = "No"
print(ans)

Submission status: Runtime Error

Solution code:

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

Submission status: Runtime Error

Solution code:
S,T = map(lambda x:x.lower(), raw_input().rstrip().split())
Sl = list(S)
Tl = list(T)
dif = {}
Sc = []
for n in range(len(S)):
    if S[n] != T[n]:
        dif[S[n]] = (T[n])
for n, s in enumerate(Sl):
    if s != Tl[n]:
        Sc.append(dif.get(s))
    else:
        Sc.append(s)
Scs = ('').join(Sc)
if Scs == T:
    print('Yes')
else:
    print('No')

Submission status: Runtime Error

Solution code:
s = input()
t = input()
start = [-1]*30
goal = [-1]*30
for i in range(0,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:
            count = 1
            break
    else:
        start[a] = b
        goal[b] = a
if count == 1:
    print("No")
else:
    print("Yes")

Submission status: Runtime Error

Solution code:
s = input()
t = input()
start = [-1]*26
goal = [-1]*26
for i in range(0,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:
            count = 1
            break
    else:
        start[a] = b
        goal[b] = a
if count == 1:
    print("No")
else:
    print("Yes")

Submission status: Runtime Error

Solution code:
s = input()
t = input()
count = 0
for i in range(26):
    start[i] = -1
    goal[i] = -1
for i in range(0,len(s)):
    a = oad(s[i])-oad("a")
    b = oad(t[i])-oad("a")
    if start[a] != -1 or goal[b] != -1:
        if start[a] != b or goal[b] != a:
            count = 1
            break
    else:
        start[a] = b
        goal[b] = a
if count == 1:
    print("No")
else:
    print("Yes")

Submission status: Runtime Error

Solution code:
s = input()
t = input()
count = 0
for i in range(oad('a'),oad('z')+1):
    start[i] = -1
    goal[i] = -1
for i in range(0,len(s)):
    a = s[i]
    b = t[i]
    if start[a] != -1 or goal[b] != -1:
        if start[a] != b or goal[b] != a:
            count = 1
            break
    else:
        start[a] = b
        goal[b] = a
if count == 1:
    print("No")
else:
    print("Yes")

Submission status: Runtime Error

Solution code:
s = input()
t = input()
count = 0
for i in range(26):
    start[i] = -1
    goal[i] = -1
for i in range(0,len(s)):
    a = s[i]
    b = t[i]
    if start[a] != -1 or goal[b] != -1:
        if start[a] != b or goal[b] != a:
            count = 1
            break
    else:
        start[a] = b
        goal[b] = a
if count == 1:
    print("No")
else:
    print("Yes")

Submission status: Runtime Error

Solution code:
s = input()
t = input()
count = 0
for i in range(26):
    start[i] = -1
    goal[i] = -1
for i in range(0,len(s)):
    a = s[i]-'a'
    b = t[i]-'a'
    if start[a] != -1 or goal[b] != -1:
        if start[a] != b or goal[b] != a:
            count = 1
            break
    else:
        start[a] = b
        goal[b] = a
if count == 1:
    print("No")
else:
    print("Yes")

Submission status: Runtime Error

Solution code:
s = list(str(input()))
t = list(str(input()))
count = 0
for i in range(26):
    start[i] = -1
    goal[i] = -1
for i in range(0,len(s)):
    a = s[i]-'a'
    b = t[i]-'a'
    if start[a] != -1 or goal[b] != -1:
        if start[a] != b or goal[b] != a:
            count = 1
            break
    else:
        start[a] = b
        goal[b] = a
if count == 1:
    print("No")
else:
    print("Yes")

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

def swap(s,c1,c2):
    if c2 in s:
        # slist = list(s)
        def rep(chr):
            if chr == c1:
                return c2
            elif chr == c2:
                return c1
            return chr
        slist = [rep(i) for i in list(a)]
        s = "".join(slist)
    #s = "".join(list(map(rep,slist)))
    else:
       s = s.replace(c1,c2)
    return s

for i in range(len(s)):
    if s[i] == t[i]:
        continue
    else:
        s = swap(s,s[i],t[i])
if s == t:
    print("Yes")
else:
    print("No")

Submission status: Runtime Error

Solution code:
import io
import sys


def solve(lista,x):
    listd = []
    listc1 = []
    listc1 += lista
    listc1.append(x)
    listc = sorted(listc1)

    for i in range(len(listc)-1):
        ans = listc[i+1] - listc[i]
        listd.append(ans)
        
    listb = []
    
    for i in lista:
        if i > x:
            ans = i-x
            listb.append(ans)
        else:
            ans = x-i
            listb.append(ans)
    listd += listb
    return min(listd),listd

# ここから下は，入力・出力形式が同じであれば，変えなくて良い．
def readQuestion():

    line1 = sys.stdin.readline().rstrip()
    list1 = line1.split(" ")
    line2 = sys.stdin.readline().rstrip()
    list2 = line2.split(" ")
    list3 = [int(a) for a in list2]
    return [list3,int(list1[1])]

def main():
    n,x = readQuestion()
    answer = solve(n,x)
    print(answer)
    
if __name__ == '__main__':
    main()

Submission status: Runtime Error

Solution code:
use std::collections::{HashMap,HashSet};
#[allow(unused_macros)]
macro_rules! invec {
    ( $t:ty ) => {{
        let mut s = String::new();
        match std::io::stdin().read_line(&mut s) {
            Ok(0) => Vec::<$t>::new(),
            Ok(n) => s
                .trim()
                .split_whitespace()
                .map(|s| s.parse::<$t>().unwrap())
                .collect::<Vec<$t>>(),
            Err(_) => Vec::<$t>::new(),
        }
    }};
}

#[allow(unused_macros)]
macro_rules! input {
    ( $($t:ty),* ) => {{
        let mut s = String::new();
        std::io::stdin().read_line(&mut s);
        let mut splits = s.trim().split_whitespace();
        ($(
            {
                 splits.next().unwrap().parse::<$t>().unwrap()
            },
        )*)
    }}
}

// #[allow(unused_must_use)]
// fn trans(s: &Vec<u8>, s_i: u8, t_i: u8) -> Vec<u8> {
//     let mut res = Vec::<u8>::with_capacity(s.len());
//     for i in 0..s.len() {
//         if s[i] == s_i {
//             res.push(t_i);
//         } else if s[i] == t_i {
//             res.push(s_i);
//         } else {
//             res.push(s[i]);
//         };
//     }
//     return res;
// }

#[allow(unused_must_use)]
#[allow(unused_variables)]
fn solve() {
    let (s,) = input!(String);
    let (t,) = input!(String);

    let mut m = HashMap::new();

    let mut t = t.chars();

    for c in s.chars() {
        let aft = t.next().unwrap();
        if let Some(val) = m.get(&c) {
            if val == &aft {
                println!("continue");
                continue;
            } else {
                println!("No");
                std::process::exit(0);
            }
        }

        m.insert(c, aft);
    }

    let set = m.values().collect::<HashSet<_>>();

    if set.len() == m.len() {
        println!("Yes");
    } else {
        println!("No");
    }

}

fn main() {
    solve();
}

Submission status: Runtime Error

Solution code:
# coding:utf-8

# 解答みながらの復習

S = str(input())
T = str(input())

Sdic = [0 for _ in range(26)]
Tdic = [0 for _ in range(26)]

alphabet = ['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']

Able = True

for i in range(len(S)):
    si = S[i]
    ti = T[i]
    if Sdic[alphabet.index(si)] == 0:
        Sdic[alphabet.index(si)] = ti
    elif Sdic[alphabet.index(si)] != 0:
        if Sdic[alphabet.index(si)] == ti:
            pass
        else:
            Able = False
            break
    elif Tdic[alphabet.index(ti)] == 0:
        Tdic[alphabet.index(ti)] = si
    elif Tdic[alphabet.index(ti)] != 0:
        if Tdic[alphabet.index(ti)] == si:
            pass
        else:
            Able = False
            break

print("Yes" if Able else "No")

Submission status: Runtime Error

Solution code:
s=list(input())
t=list(input())
rs=[-1 for i in range(len(s))]
rt=[-1 for i in range(len(t))]
ans='?'
for i in range(len(s)):
    if rs[i]>=0:
        if rs[i]!=t[i]:
            ans='No'
            break
    if rt[i]>=0  
        if rt[i]!=s[i]:
            ans='No'
            break
    if rs[i]<0:
        rs[i]=t[i]
    if rt[i]<0:
        rt[i]=s[i]
else:
    ans='Yes'
print(ans)

Submission status: Runtime Error

Solution code:
one=list(input())
#print(one)
two=list(input())

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")