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:
S = input()
T = input()
N = len(S)

dict_S = {}
dict_T = {}

for i in range(N):
    if S[i] in dict_S:
        if dict_S[S[i]] != T[i]:
            print("No")
            eixt()
    if T[i] in dict_T:
        if dict_T[T[i]] != S[i]:
            print("No")
            exit()
    dict_S[S[i]] = T[i]
    dict_T[T[i]] = S[i]
print("Yes")

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
s=str(input())
t=str(input())
temps=list(set(s))
tempt=list(set(t))
temps=sorted(list(temps))
tempt=sorted(list(tempt))
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])
count=0
for i in range(0,len(temps)):
  if temps[i]==tempt[i]:
    count=count+1
if count==len(temps):
  print("Yes")
else:
  print("No")

Submission status: Runtime Error

Solution code:
from collections import deque
from heapq import heapify,heappop,heappush,heappushpop
from copy import copy,deepcopy
from itertools import product,permutations,combinations,combinations_with_replacement
from collections import defaultdict,Counter
from bisect import bisect_left,bisect_right
# from math import gcd,ceil,floor,factorial
# from fractions import gcd
from functools import reduce
from pprint import pprint

INF = float("inf")

def myinput():
    return map(int,input().split())

def mylistinput(n):
    return [ list(myinput()) for _ in range(n) ]

def mycol(data,col):
    return [ row[col] for row in data ]

def mysort(data,col,reverse_flag):
    data.sort(key=lambda x:x[col],reverse=reverse_flag)
    return data

def mymax(data):
    M = -1*float("inf")
    for i in range(len(data)):
        m = max(data[i])
        M = max(M,m)
    return M

def mymin(data):
    m = float("inf")
    for i in range(len(data)):
        M = min(data[i])
        m = min(m,M)
    return m

def mycount(ls,x):
    # lsはソート済みであること
    l = bisect_left(ls,x)
    r = bisect_right(ls,x)
    return (r-l)

def myoutput(ls,space=True):
    if space:
        if len(ls)==0:
            print(" ")
        elif type(ls[0])==str:
            print(" ".join(ls))
        elif type(ls[0])==int:
            print(" ".join(map(str,ls)))
        else:
            print("Output Error")
    else:
        if len(ls)==0:
            print("")
        elif type(ls[0])==str:
            print("".join(ls))
        elif type(ls[0])==int:
            print("".join(map(str,ls)))
        else:
            print("Output Error")

S = input()
T = input()

if S==T:
    print("Yes")
    exit()

ls = ["?"]*26
for i in range(len(S)):
    # print(i,S)
    s = S[i]
    t = T[i]
    if s==t:
        no = ord(t) - 97
        ls[no] = s
    else:
        no = ord(t) - 97
        if ls[no]=="?":
            ls[no] = s
            S = S.replace(s,t)
        else:
            if ls[no]==t:
                S = S.repalce(s,t)
            else:
                print("No")
                exit()
# print(ls)
print("Yes")
exit()

Submission status: Runtime Error

Solution code:
chokudai
redcoder

Submission status: Runtime Error

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

d={}
for i in range(len(s)):
  if s[i]!=t[i]:
    if s[i] in d:
      if d[s[i]]!=t[i]
        print('No')
        exit()
      else:
       pass
    else:
      d[s[i]]=t[i]
  else:
    if s[i] in d and d[s[i]]!=t[i]:
      print('No')
      exit()
print('Yes')

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
str1 = input()
str2 = input()

dict = dict()
ans = "Yes"

for i in range(len(str1)):
    if(str1[i] in dict):
        if(dict[str[i]] != str2[i]):
            ans = "No"
    else:
        dict[str1[i]] = str2[i]

print(ans)

Submission status: Runtime Error

Solution code:
from collections import defaultdict
S, T = map(lambda x: x.strip(), open(0).read().split())

from collections import defaultdict
S, T = map(lambda x: x.strip(), open(0).read().split())

ds, dt = defaultdict(str), defaultdict(str)
ans = 'Yes'
for s, t in zip(S, T):
    if not ds[s] or ds[s] == t:
        ds[s] = t
    else:
        ans = 'No'
        break
    if not dt[t] or dt[t] == s:
        dt[t] = s
    else:
        ans = 'No'
        break
print(ans)

Submission status: Runtime Error

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

ds = {}
dt = {}
ans = 'Yes'
for s, t in zip(S, T):
    if s not in ds or ds[s] == t:
        ds[s] = t
    else:
        ans = 'No'
        break
    if t not in dt or dt[s] == s:
        dt[t] = s
    else:
        ans = 'No'
        break
print(ans)

Submission status: Runtime Error

Solution code:
S=input()
T=input()
A=[]
B=[]
c,d=0,0
for i in range(len(S)):
  if S[i]==S[i+1]:
    c+=1
  else:
    A.append(c)
    c=0

for i in range(len(T)):
  if T[i]==T[i+1]:
    d+=1
  else:
    B.append(d)
    d=0
print("Yes" if A==B else "No")

Submission status: Runtime Error

Solution code:
def StringTransformation(s , t):

    taious = {}
    taiout = {}
    ans = "Yes"

    for i in range(len(s)):
        if t[i] in taiout.keys() or s[i] in taious.keys():
            if taiout[t[i]] != s[i] or taious[s[i]] != t[i]:
                ans = "No"
                break
        else:
            taiout[t[i]] = s[i]
            taious[s[i]] = t[i]

    return ans

def main():
    s = str(input())
    t = str(input())
    print(StringTransformation(s , t))

if __name__ == '__main__':
    main()

Submission status: Runtime Error

Solution code:
mod = 10 ** 9 + 7
mod2 = 2**61+1
from collections import deque
import heapq
from bisect import bisect_left, insort_left, bisect_right

def iip(listed=True):
    ret = [int(i) for i in input().split()]
    if len(ret) == 1 and not listed:
        return ret[0]
    return ret

def iip_ord():
    return [ord(i) - ord("a") for i in input()]


def main():
    ans = solve()
    if ans is not None:
        print(ans)

def solve():
    #N, M = iip(False)
    S = input()
    T = input()

    d1 = {}
    d2 = {}
    for s, t in zip(S, T):
        if t not in d1:
            d1[t] = s
        if s not in d1:
            d2[s] = t

            #print(t, t, d[s])
        if d1[t] != s or d2[s] != t:
            print("No")
            return
    print("Yes")



#####################################################ライブラリ集ここから

def fprint(s):
    for i in s:
        print(i)

def split_print_space(s):
    print(" ".join([str(i) for i in s]))


def split_print_enter(s):
    print("\n".join([str(i) for i in s]))


def koenai_saidai_x_index(sorted_list, n):
    l = 0
    r = len(sorted_list)
    if len(sorted_list) == 0:
        return False
    if sorted_list[0] > n:
        return False

    while r - l > 1:
        x = (l + r) // 2
        if sorted_list[x] == n:
            return x
        elif sorted_list[x] > n:
            r = x
        else:
            l = x
    return l


def searchsorted(sorted_list, n, side):
    if side not in ["right", "left"]:
        raise Exception("sideはrightかleftで指定してください")

    l = 0
    r = len(sorted_list)

    if n > sorted_list[-1]:
        # print(sorted_list)
        return len(sorted_list)
    if n < sorted_list[0]:
        return 0

    while r - l > 1:
        x = (l + r) // 2
        if sorted_list[x] > n:
            r = x
        elif sorted_list[x] < n:
            l = x
        else:
            if side == "left":
                r = x
            elif side == "right":
                l = x

    if side == "left":
        if sorted_list[l] == n:
            return r - 1
        else:
            return r

    if side == "right":
        if sorted_list[l] == n:
            return l + 1
        else:
            return l


def soinsuu_bunkai(n):
    ret = []
    for i in range(2, int(n ** 0.5) + 1):
        while n % i == 0:
            n //= i
            ret.append(i)
        if i > n:
            break
    if n != 1:
        ret.append(n)
    return ret


def conbination(n, r, mod, test=False):
    if n <= 0:
        return 0
    if r == 0:
        return 1
    if r < 0:
        return 0
    if r == 1:
        return n
    ret = 1
    for i in range(n - r + 1, n + 1):
        ret *= i
        ret = ret % mod

    bunbo = 1
    for i in range(1, r + 1):
        bunbo *= i
        bunbo = bunbo % mod

    ret = (ret * inv(bunbo, mod)) % mod
    if test:
        # print(f"{n}C{r} = {ret}")
        pass
    return ret


def inv(n, mod):
    return power(n, mod - 2)


def power(n, p, mod_= mod):
    if p == 0:
        return 1
    if p % 2 == 0:
        return (power(n, p // 2, mod_) ** 2) % mod_
    if p % 2 == 1:
        return (n * power(n, p - 1, mod_)) % mod_


if __name__ == "__main__":
    main()

Submission status: Runtime Error

Solution code:
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline

S = readline().rstrip().decode()
T = readline().rstrip().decode()

cnt = [[0] * 26 for i in range(26)]

for i in range(len(S)):
    cnt[ord(S[i]) - ord('a')][ord(T[i]) - ord('a')] += 1

for j in range(26):
    n = 0
    for i in range(26):
        if cnt[i][j] != 0:
            n += 1
    if n > 1:
        print("No")
        exit(0)
exit(1)

Submission status: Runtime Error

Solution code:
from collections import Counter
s = sorted(Counter(input()).values)
t = sorted(Counter(input()).values)
print("Yes" if s==t else "No")

Submission status: Runtime Error

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

st = list(zip(s, t))
st.sort(key=lambda x:x[1])
dic_ST = set()
ans = "Yes"

for i in range(len(s)-1):
    if st[i][1] == st[i+1][1]:
        if st[i][0] != st[i+1][0]:
            ans = "No"
        if st[i][0] in dic_ST:
            ans = " No"
    else:
        dic_ST.add(st[i][0])

if st[-2][1] == st[-1][1]:
    if st[-2][0] != st[-1][0]:
        ans = "No"
    if st[-1][0] in dic_ST:
        ans = " No"
else:
    dic_ST.add(st[-1][0])

print(ans)

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
S = str(input())
T = str(input())
alp = "abcdefghijklmnopqrstuvwxyz"
for i in range(0,10**7):
  if S[i] != T[i]:
    S = S.translate(str.maketrans({S[i]:T[i], T[i]:S[i]}))
  if S == T:
    print("Yes")
    exit()
print("No")

Submission status: Runtime Error

Solution code:
S = str(input())
T = str(input())
alp = "abcdefghijklmnopqrstuvwxyz"
for i in range(0,len(alp)):
  if S[i] != T[i]:
    S = S.translate(str.maketrans({S[i]:T[i], T[i]:S[i]}))
  if S == T:
    print("Yes")
    exit()
print("No")

Submission status: Runtime Error

Solution code:
s = list(input())
t = list(input())
dic = {}
flg = 'Yes'
for i in range(len(s)):
    if s[i] in dic.keys():
        if t[i] !=  dic.values(s[i]):
            flg = 'No'
    else:
        dic[s[i]] = t[i]
print(flg)

Submission status: Runtime Error

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

b = []

for i in range(len(s)):
    c1 = s[i]
    c2 = t[i]
    if c1 == c2:
        for i in range(len(b)):
            if b[j][0] == c1:
                print("No")
                exit()
    if c1 != c2:
        for j in range(len(b)):
            if b[j][0] == c1 and b[j][1] != c2:
                print("No")
                exit()
            if b[j][0] != c1 and b[j][1] == c2:
                print("No")
                exit()
            if b[j][0] == c1 and b[j][1] == c2:
                break
        else:
            b.append([c1, c2])
else:
    print("Yes")

Submission status: Runtime Error

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

b = []

for i in range(len(s)):
    c1 = s[i]
    c2 = t[i]
    if c1 == c2:
        if b[j][0] == c1:
            print("No")
            exit()
    if c1 != c2:
        for j in range(len(b)):
            if b[j][0] == c1 and b[j][1] != c2:
                print("No")
                exit()
            if b[j][0] != c1 and b[j][1] == c2:
                print("No")
                exit()
            if b[j][0] == c1 and b[j][1] == c2:
                break
        b.append([c1, c2])
else:
    print("Yes")

Submission status: Runtime Error

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

a = [chr(i + ord("a")) for i in range(26)]
b = []

for i in range(len(s)):
    if s[i] != t[i]:
        c1 = s[i]
        c2 = t[i]
        if c2 not in a:
            for j in range(len(b)):
                if b[j][1] == c2 and b[j][0] != c1:
                    print("No")
                    exit()
        a.remove(c2)
        b.append([c1, c2])
else:
    print("Yes")

Submission status: Runtime Error

Solution code:
s=input()
t=input()
u=[]
v=[]
s_len=len(s)
for i in range(s_len):
    s_i=s[i]
    t_i=t[i]
    ts=t_i+s_i
    if s_i!=t_i:
        if ts not in u:
            u.append(ts)
    elif s_i not in v:
        v.append(s_i)
u_len=len(u)
ans="Yes"
if u_len!=0:
    u.sort()
    u.append("XX")
    u_len=len(u)
    for i in range(u_len):
        if u[i][0] in v or u[i][1] in v:
            ans="No"
            break
        elif u[i][0]==u[i+1][0] and u[i][1]!=u[i+1][1]:
            ans="No"
            break       
print(ans)

Submission status: Runtime Error

Solution code:
s=input()
t=input()
u=[]
v=[]
s_len=len(s)
for i in range(s_len):
    s_i=s[i]
    t_i=t[i]
    ts=t_i+s_i
    if s_i!=t_i:
        if ts not in u:
            u.append(ts)
    elif s_i not in v:
        v.append(s_i)
u.sort()
u.append("XX")
ans="Yes"
u_len=len(u)
for i in range(u_len):
    if u[i][0] in v or u[i][1] in v:
        ans="No"
        break
    elif u[i][0]==u[i+1][0] and u[i][1]!=u[i+1][1]:
        ans="No"
        break       
print(ans)

Submission status: Runtime Error

Solution code:
canChange = {alphabet: True for alphabet in "abcedfghijklmnopqrstuvwxyz"}
 
s = str(input())
t = str(input())
 
for i in s:
  if !canChange[s[i]]:
    print("No")
    break
  elif s[i]!=t[i]:
    t.replace(t[i], s[i])
    canChange[t[i]] = False
  else: #s[i]==t[i]:
    canChange[t[i]] = False
    continue
    
return("Yes)

Submission status: Runtime Error

Solution code:
canChange = {alphabet:True alphabet in "abcedfghijklmnopqrstuvwxyz"}
 
s = str(input())
t = str(input())
 
for i in s:
  if !canChange[s[i]]:
    print("No")
    break
  elif s[i]!=t[i]:
    t.replace(t[i], s[i])
    canChange[t[i]] = False
  else: #s[i]==t[i]:
    canChange[t[i]] = False
    continue
    
return("Yes")

Submission status: Runtime Error

Solution code:
canChange = {alphabet:True alphabet in "abcedfghijklmnopqrstuvwxyz"}

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

for i in s:
  if !canChange[s[i]]:
    print("No")
    break
  elif s[i]!=t[i]:
    t.replace(t[i], s[i])
    canChange[t[i]] = False
  else: #s[i]==t[i]:
    canChange[t[i]] = False
    continue
    
return("Yes)

Submission status: Runtime Error

Solution code:
input1 = input()
input2 = input()

for i in set(input1):
    if input1.count(i) == input2.count(i):
        pass
    else:
        print('No')
        sys.exit()
print('Yes')

Submission status: Runtime Error

Solution code:
import collections

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

ss=collections.Counter(s)
tt=collections.Counter(t)

s_v = ss.values().sorted()
t_v = tt.values().sorted()

if s_v == t_v:
    print("Yes")
else:
    print("No")

Submission status: Runtime Error

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

st=[]
for i in range(len(s)):
    st.append([s[i],t[i]])
#print(st)
st.sort()
#print(st)
    
for i in range(len(st)-1):
    if st[len(st)-i-1]==st[len(st)-i-2]:
        del st[len(st)-i-1]
        
#print(st)

yesno="Yes"
for i in range(len(st)-1):
    sj,tj=st[len(st)-i-1]
    sk,tk=st[len(st)-i-2]
    if sj==sk and tj!=tk:
        yesno="No"
        break
    
print(yesno)

Submission status: Runtime Error

Solution code:
S, T = input(), input()
ma, ima = {}, {}
ok = True
for i in range(len(S)):
    s, t = S[i], T[i]
    if s in ma and ma[s] != t:
        ok = False
    if t in ima and ima[t] != s:
        ok = False
    ma[s] = t, ima[t] = s
if ok:
    print("Yes")
else:
    print("No")

Submission status: Runtime Error

Solution code:
c = []
for i in range(3):
    c.append(list(map(int,input().split())))
a = [0,0,0]
b = [0,0,0]
for i in range(3):
    b[i] = c[i][0]-0
for i in range(3):
    a[i] = c[0][i]-b[0]
for i in range(3):
    for j in range(3):
        if a[j]+b[i] != c[i][j]:
            print("No")
            exit()
print("Yes")

Submission status: Runtime Error

Solution code:
S = input()
T = input()
for i in range(len(S)):
  if S[i] != T[i]:
    if T[i] in S:
      S.translate(str.maketrans(S[i]: T[i], T[i]: S[i]))
    else:
      S.translate(str.maketrans(S[i]: T[i], T[i]: None))
if S == T:
  print('Yes')
else:
  print('No')

Submission status: Runtime Error

Solution code:
S = input()
T = input()
for i in range(len(S)):
  if S[i] != T[i]:
    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 collections

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

G = S + T
G = collections.Counter(G)
A = list(G.values())
#print(A)

cnt = 0
for i in range(len(S)):
    if A[i] % 2 !=0  : 
        cnt +=1

if cnt == 0:
    print('Yes')
else:
    print('No')

Submission status: Runtime Error

Solution code:
from collections import Counter

S=input()
T=input()

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

S.sort()
T.sort()

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

Submission status: Runtime Error

Solution code:
s = input()
t = input()
d_s = dict()
d_t = dict()
for i in range(len(s)):
  if not s[i] in d:
    d_s[s[i]] = t[i]
  elif d_s[s[i]] != t[i]:
    print('No')
    exit()
  if not t[i] in d:
    d_t[t[i]] = s[i]
  elif d_t[t[i]] != s[i]:
    print('No')
    exit()
print('Yes')

Submission status: Runtime Error

Solution code:
s=input()
t=input()
n=len(s)
sabc={}
tabc={}
al=list("abcdefghijklmnopqrstuvwxyz")
for i in range(26):
  sabc[al[i]]=0
  tabc[al[i]]=0 
s=list(s)
t=list(t)
s.sort()
t.sort()
count=1
for i in range(n-1):
  if s[i]==s[i+1]:
    count+=1
  else:
    sabc[s[i]]=count
    count=1
    syu+=1
sabc[s[-1]]=count
count=1
syu=0
for i in range(n-1):
  if t[i]==t[i+1]:
    count+=1
  else:
    tabc[t[i]]=count
    count=1
    syu+=1
tabc[t[-1]]=count

for i in al:
  if tabc[i]!=0 and sabc!=0:
    if tabc[i]!=sabc[i]:
      print("No")
      count=-1
      break
if count!=-1:
  print("Yes")

Submission status: Runtime Error

Solution code:
s=input()
t=input()
n=len(s)
sabc=[0]*26
tabc=[0]*26
s=list(s)
t=list(t)
s.sort()
t.sort()
count=1
syu=0
for i in range(n-1):
  if s[i]==s[i+1]:
    count+=1
  else:
    sabc[syu]=count
    count=1
    syu+=1
sabc[syu]=count
count=1
syu=0
for i in range(n-1):
  if t[i]==t[i+1]:
    count+=1
  else:
    tabc[syu]=count
    count=1
    syu+=1
tabc[syu]=count

for i in range(n):
  if tabc[i]!=0 and sabc!=0:
    if tabc[i]!=sabc[i]:
      print("No")
      count=-1
      break
if count!=-1:
  print("Yes")

Submission status: Runtime Error

Solution code:
import sys
import itertools
import numpy
input = sys.stdin.readline
Sa = input()
Ta = input()
S = ['0'] * len(Sa)
T = ['0'] * len(Ta)
for i in range(len(Sa)) :
    S[i] = Sa[i]
for i in range(len(Ta)) :
    T[i] = Ta[i]
ans = {}
for cs,ct in zip(S,T) :
    if cs not in ans.keys() and ct not in ans.values() :
        ans[cs] = ct
    else :
        if ans[cs] == ct :
            continue
        else :
            print("No")
            break
else :
    print("Yes")

Submission status: Runtime Error

Solution code:
import sys
import defaultdict
input=sys.stdin.readline()
s=input().rstrip()
t=input().rstrip()
dct=defaultdict(int)
for i in range(len(s)):
  if not dct[s[i]]:
    dct[s[i]]=t[i]
  elif dct[s[i]]!=t[i]:
    print("No")
    exit()
ls=[]
for i in dct.values():
  if i in ls:
    print("No")
    exit()
  else:
    ls.append(i)
print("Yes")

Submission status: Runtime Error

Solution code:
function main(arg) {
    arg  = arg.split("\n")
    var s = arg[0]
    var t = arg[1]

    while (1) {
        if (s === "") {
            break
        } 

        s = s.split(s[0]).join("")
        t = t.split(t[0]).join("")

        if (s.length !== t.length) {
            console.log('No')
            return;
        }
    }
    console.log('Yes')
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));

Submission status: Runtime Error

Solution code:
import sys
s=input()
t=input()
n=len(s)-1
d=dict()
for i in range(n):
  if t[i] in d.keys():
  	if d[t[i]] != s[i]:
      print("No")
      sys.exit()
  else:
    d[t[i]] = s[i]
else:
  print("Yes")

Submission status: Runtime Error

Solution code:
S = input()
T = input()
ans = "Yes"
start = [-1]*26
goal = [-1]*26
for i in range(len(S)):
    s,t = ord(S[i])-96,ord(T[i])-96
    if start[s]!=-1 or goal[t]!=-1:
        if start[s]!=t or goal[t]!=s:
            ans = "No"
    else:
        start[s] = t
        goal[t] = s
print(ans)

Submission status: Runtime Error

Solution code:
S=str(input())
T=str(input())
dic={}
for s,t in zip(S,T):
    if s in dic:
        if dic[s]!=t:
            print("No")
            exit()
    else:
        dic[s]=t

if len(d)!=len(set(d.values())):
    print("No")   
else:
    print("Yes")

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
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 c[b[i]]!=a[i]:
    state=False
if state:
  print('Yes')
else:
  print('No')

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
l=input()
m=input()
ll=set(l)-sei(m)
lll=set(m)-set(l)
print(["No","Yes"][len(ll)==len(lll)])

Submission status: Runtime Error

Solution code:
from collections import Counter as c
s=input()
t=input()
if sorted(s.values())==sorted(t.values()):
  print("Yes")
else:
  print("No")

Submission status: Runtime Error

Solution code:
import sys
input = sys.stdin.readline

S = input().strip()
T = input().strip()

dic = defaultdict(list)

def check(d):
    for k, i in d.items():
        if k != i:
            return False
    else:
        return True

for s, t in zip(S, T):
    if s not in dic:
        dic[s] = t
    elif dic[s] != t:
        print('No')
        exit()

if len(dic) != len(set(dic.values())):
    print('No')
else:
    print('Yes')

Submission status: Runtime Error

Solution code:
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy,copy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd

def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

def main():
    s = list(input())
    t = list(input())
    n = len(s)
    s_dict = defaultdict(int)
    t_dict = defaultdict(int)
    for i in range(n):
        s_dict[s[i]] += 1
        t_dict[t[i]] += 1

    print(s_dict)
    print(t_dict)

    if list(s_dict.values().sort()) == list(t_dict.values().sort()):
        print('Yes')
    else:
        print('No')
        

if  __name__=='__main__':
    main()

Submission status: Runtime Error

Solution code:
azzel
apple

Submission status: Runtime Error

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

con = 0

ans = "Yes"

for i in range(0,len(S)):
  cutS = S[i+1:]
  cutT = T[i+1:]
  if S[i] in cutS:
    print(S[i],cutS)
    j = cutS.index(S[i]) + (i + 1)
    print(T[i],T[j])
    if T[i] != T[j]:
      ans = "No"
      break
  if T[i] in cutT:
    k = cutT.index(T[i]) + (i + 1)
    if S[i] != S[k]:
      ans = "No"
      break

print(ans)

Submission status: Runtime Error

Solution code:
s=input()
t=input()
n=len(s)
A='abcdefghijklmnopqrstuvwxyz'
i=0
while A and i<n+1:
	if s==t:
		print('Yes')
		exit()
	if s[i]!=t[i]:
		if s[i] in A and t[i] in A:
			s=s.replace(s[i],'X').replace(t[i],s[i]).replace('X',t[i])
			A=A.replace(s[i],'').replace(t[i],'')
	i+=1
print('No')

Submission status: Runtime Error

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

dds=defaultdict(int)
ddt=defaultdict(int)

for i in range(L):
    s=S[i]
    t=T[i]
    if dds[s]==0:
        dds[s]=t
    else:
        if dds[s]!=t:
            print("No")
            exit()
    if ddt[t]==0:
        ddt[t]=s
    else:
        if ddt[t]!=s:
            print("No")
            exit()
print("Yes")

Submission status: Runtime Error

Solution code:
s = input()
target = input()
for index in xrange(len(s)):
    ss = s[index]
    tt = target[index]
	
    if s[:index] != target[:index]:
        break
    if ss == tt:
        continue
    else: #ssとttを相互変換する
        s = s.replace(ss,"0").replace(tt,ss).replace("0",tt)

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

Submission status: Runtime Error

Solution code:
S = input()
T = input()
cnt = 0
for i in range(len(S)):
  if cnt > 30:
    break
  if S[i] != T[i]:
    X = S[i]
    S = S.replace(S[i],"X")
    S = S.replace(T[i],X)
    S = S.replace("X",T[i])
    cnt += 1
  print(S)
print("Yes" if S == T else "No")

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
aaa = input()
bbb = input()
d = {}
ans = 'Yes'
for a, b in zip(aaa, bbb):
  if a in d and d.get(a) != b:
    print ('%s %s %s %s' % (aaa, bbb, a,b ))
    ans = 'No'
  d[a] = b
vs = list(d.values())
if max([vs.count(k) for k in vs]) >= 2:
  ans = 'No'
print(ans)

Submission status: Runtime Error

Solution code:
S = list(input())
T = list(input())
S.sort()
T.sort()
SKind = []
TKind = []
cnt = 1
for i in range(1,len(S)):

    if i == N-1:
        if S[i]==S[i-1]:
            cnt += 1
            SKind.append(cnt)
        else:
            SKind.append(cnt)
            SKind.append(1)
    elif S[i]==S[i-1]:
        cnt+=1
    elif S[i]!=S[i-1]:
        SKind.append(cnt)
        cnt = 1
cnt = 1        
for i in range(1,len(T)):
    if i == N-1:
        if T[i]==T[i-1]:
            cnt += 1
            TKind.append(cnt)
        else:
            TKind.append(cnt)
            TKind.append(1)
    elif T[i]==T[i-1]:
        cnt+=1
    elif T[i]!=T[i-1]:
        TKind.append(cnt)
        cnt = 1
SKind.sort()
TKind.sort()
if SKind == TKind:
    print("Yes")
else: print("No")