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: Wrong Answer

Solution code:
from operator import itemgetter
S = list(input())
T = list(input())

G = []
for i in range(len(S)):
    G.append([S[i],T[i]])
G = sorted(G, key=itemgetter(0))
print(G)

cnt = 0
for i in range(len(S)):
    if G[i][0] == G[i][1]:
        tmp = G[i][0]
        for j in range(len(S)):
            if G[j][0] == tmp and G[j][1] != tmp:
                cnt +=1
            elif G[j][1] == tmp and G[j][0] != tmp:
                cnt +=1

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

Submission status: Wrong Answer

Solution code:
s=input()
t=input()
n=len(s)
import collections
d=collections.defaultdict(list)
d2=collections.defaultdict(list)
for i in range(n):
    if s[i]!=t[i]:
        d[s[i]].append(t[i])
        d2[t[i]].append(s[i])

for i in d.values():
    i=set(i)
    if len(i)!=1:
        print('No')
        exit()
for i in d2.values():
    i=set(i)
    if len(i)!=1:
        print('No')
        exit()
print('Yes')

Submission status: Wrong Answer

Solution code:
def checkTrans(s, t):
    m = {}
    for sc, tc in zip(s, t):
        if tc in m:
            if m[tc] != sc:
                return False
        else:
            m[tc] = sc

    return True

s = input()
t = input()

if checkTrans(s, t):
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

Solution code:
import collections

S = input()
T = input()

reg = [None]*26
reg_flag = [0]*26

for i in range(len(S)):
    index = ord(S[i])-97
    if reg_flag[index] == 0:
        reg[index] = T[i]
        reg_flag[index] = 1

reg = filter(lambda x: x != None, reg)
if collections.Counter(reg).most_common()[0][1] > 1:
    print('No')
else:
    print('Yes')

Submission status: Wrong Answer

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

reg = [None]*26
reg_flag = [0]*26

for i in range(len(S)):
    index = ord(S[i])-97
    if reg_flag[index] == 0:
        reg[index] = T[i]
        reg_flag[index] = 1

        index_T = ord(T[i])-97
        if reg_flag[index_T] == 0:
            reg[index_T] = S[i]
            reg_flag[index_T] = 1

    if reg[index] == T[i]:
        pass
    else:
        print('No')
        exit()

print('Yes')

Submission status: Wrong Answer

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

S = sorted(S)
T = sorted(T)

reg = [None]*26
reg_flag = [0]*26

for i in range(len(S)):
    index = ord(S[i])-97
    if reg_flag[index] == 0:
        reg[index] = T[i]
        reg_flag[index] = 1

        index_T = ord(T[i])-97
        if reg_flag[index_T] == 0:
            reg[index_T] = S[i]
            reg_flag[index_T] = 1

    if reg[index] == T[i]:
        pass
    else:
        print('No')
        exit()

print('Yes')

Submission status: Wrong Answer

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

reg = [None]*26
reg_flag = [0]*26

for i in range(len(S)):
    index = ord(S[i])-97
    if reg_flag[index] == 0:
        reg[index] = T[i]
        reg_flag[index] = 1

        index_T = ord(T[i])-97
        if reg_flag[index_T] == 0:
            reg[index_T] = S[i]
            reg_flag[index_T] = 1

    if reg[index] == T[i]:
        pass
    else:
        print('No')
        exit()

print('Yes')

Submission status: Wrong Answer

Solution code:
def main():
    S = input()
    T = input()
    trans = {}
    for i in range(97, 97 + 26):
        trans[chr(i)] = ""
    for s, t in zip(S, T):
        if trans[t] == "":
            trans[t] = s
        elif not trans[t] == s:
            print("No")
            break
    else:
        print("Yes")


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

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

s_len = len(set(S))
t_len = len(set(T))

if s_len == t_len:
  print('Yes')
else:
  print('No')

Submission status: Wrong Answer

Solution code:
#coding: utf-8
import math
import heapq
import bisect
import numpy as np
from collections import Counter
#from scipy.misc import comb

S = input()
T = input()

dict = {}
flg = 1
for i in range(len(S)):
    if S[i] in dict and T[i] in dict:
        if S[i] != dict[T[i]] or T[i] != dict[S[i]]:
            flg = 0
            break
    elif S[i] not in dict and T[i] not in dict:
        dict[S[i]] = T[i]
        dict[T[i]] = S[i]
    else:
        flg = 0
        break

if flg:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import collections

S = input()
T = input()

s_counter = collections.Counter(S)
t_counter = collections.Counter(T)

ans = "Yes"
for s, t in zip(s_counter.values(), t_counter.values()):
    if s != t:
        ans = "No"
        break
print(ans)

Submission status: Wrong Answer

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

a = [[0 for _ in range(26)] for _ in range(26)]
for i, j in zip(s, t):
    a[ord(j) - 97][ord(i) - 97] = 1

for i in a:
    if sum(i) >= 2:
        print("No")
        exit()
print("Yes")

Submission status: Wrong Answer

Solution code:
s = input()
t = input()
dict = {}
ans = "Yes"
for i in range(len(s)):
    if s[i] != t[i]:
        if t[i] in dict:
            ans = "No"
            break
        else:
            dict.update({t[i]:True})
print(ans)

Submission status: Wrong Answer

Solution code:
from collections import Counter
S=Counter(input())
T=Counter(input())
for s,v in S.items():
    if s in T:
        t=T[s]
    else:
        t=0
    if (v-t)%2==1:
        print('No')
        exit()
print('Yes')

Submission status: Wrong Answer

Solution code:
from collections import Counter

S = input()
T = input()

s = list(Counter(S).values())
t = list(Counter(T).values())
if len(s) != len(t) or s != t:
    print("No")
else:
    print("Yes")

Submission status: Wrong Answer

Solution code:
S = input()
T = input()
dictionary = {}
ans = "Yes"
for i in range(len(S)):
    if T[i] in dictionary:
        if dictionary[T[i]] == S[i]:
            continue
        else:
            ans = "No"
    else:
        dictionary[T[i]] = S[i]

print(ans)

Submission status: Wrong Answer

Solution code:
import sys
s=input()
t=input()
s=list(set(s))
t=list(set(t))
s=sorted(s)
t=sorted(t)
cnt=0
if len(s)!=len(t):
    print("No")
    sys.exit()
for i in range(len(s)):
    if s[i]!=t[i]:
        cnt+=1
if cnt<=1:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
s = sorted(input())
t = sorted(input())
c = []
for i in range(len(s)):
    if s[i] != t[i]:
        if s[i] in c:
            print("No")
            break
        c.append(t[i])
else:print("Yes")

Submission status: Wrong Answer

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

ans = "Yes"
_dict = {}

for i in range(len(s)):
    if s[i]!=t[i] and s[i] not in _dict:
        _dict[s[i]]=t[i]
    elif s[i]!=t[i] and s[i] in _dict:
        if t[i] != _dict[s[i]]:
            ans="No"
            break

_dict = {}
for i in range(len(s)):
    if s[i]!=t[i] and t[i] not in _dict:
        _dict[t[i]]=s[i]
    elif s[i]!=t[i] and t[i] in _dict:
        if s[i] != _dict[t[i]]:
            ans="No"
            break
print(ans)

Submission status: Wrong Answer

Solution code:
# coding: utf-8
# Your code here!
S=[i for i in input()]
T=[i for i in input()]
N=len(S)
S.sort()
T.sort()
C1=[0]
C2=[0]
cnt=1
for i in range(N-1):
    if S[i]==S[i+1]:
        cnt+=1
    else:
        C1.append(cnt)
        cnt=1
cnt=1
for i in range(N-1):
    if T[i]==T[i+1]:
        cnt+=1
    else:
        C2.append(cnt)
        cnt=1
n1=len(C1)
n2=len(C2)
#print(C1,C2,n1,n2)
flg=0
if n1!=n2:
    print('No')
    flg=1
else:
    for i in range(n1):
        if C1[i]!=C2[i]:
            print('No')
            flg=1
            break
    if flg==0:
        print('Yes')

Submission status: Wrong Answer

Solution code:
# coding: utf-8
# Your code here!
S=[i for i in input()]
T=[i for i in input()]
N=len(S)
S.sort()
T.sort()
C1=[0]
C2=[0]
cnt=1
for i in range(N-1):
    if S[i]==S[i+1]:
        cnt+=1
    else:
        C1.append(cnt)
        cnt=1
cnt=1
for i in range(N-1):
    if T[i]==T[i+1]:
        cnt+=1
    else:
        C2.append(cnt)
        cnt=1
n1=len(C1)
n2=len(C2)
flg=0
if n1!=n2:
    print('No')
    flg=1
else:
    for i in range(n1):
        if flg==0 and C1[i]!=C2[i]:
            print('No')
            flg=1
            break
        if flg==0:
            print('Yes')
            break

Submission status: Wrong Answer

Solution code:
# coding: utf-8
# Your code here!
S=[i for i in input()]
T=[i for i in input()]
N=len(S)
S.sort()
T.sort()
C1=[]
C2=[]
cnt=1
for i in range(N-1):
    if S[i]==S[i+1]:
        cnt+=1
    else:
        C1.append(cnt)
        cnt=1
cnt=1
for i in range(N-1):
    if T[i]==T[i+1]:
        cnt+=1
    else:
        C2.append(cnt)
        cnt=1
n1=len(C1)
n2=len(C2)
flg=0
if n1!=n2:
    print('No')
    flg=1
else:
    for i in range(n1):
        if flg==0 and C1[i]!=C2[i]:
            print('No')
            flg=1
            break
        if flg==0:
            print('Yes')
            break

Submission status: Wrong Answer

Solution code:
S = input()
T = input()
d = {}
for s, t in zip(T, S):
    if s in d:
        if t != d[s]:
            print("No")
            break
    else:
        d[s] = t
else:
    n = 0
    p = None
    f = None
    while d:
        s, t = d.popitem()
        if s == p:
            n += 1
        else:
            if f == t and n & 1:
                print("No")
                break
            n = 0
            f = s
        p = t
    else:
        print("Yes")

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:

S = input()
T = input()
from collections import defaultdict

dict = defaultdict(str)
for i in range(len(S)):
  if dict[T[i]] and dict[T[i]] != S[i]:
    print("No")
    exit()
  else:
    dict[T[i]] = S[i]

print("Yes")

Submission status: Wrong Answer

Solution code:
s, t, f = [0]*26, [0]*26, 0
for c in input(): s[ord(c)-97]+=1
for c in input(): t[ord(c)-97]+=1
for i in range(26): f |= (s[i]!=t[i])&bool(s[i])&bool(t[i])
print("YNeos"[f::2])

Submission status: Wrong Answer

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

ans = {c:[] for c in 'abcdefghijklmnopqrstuvwxyz'}
cnt = 0
for a,b in zip(s,t):
    ans[b].append(a)
    # elif ans[a] != a and ans[ans[a]] != ans[b]:
    #     print(a, b, '0', a, b, ans[a],  ans[b], cnt)
    #     print('No')
    #     break
    cnt += 1

if len([0 for v in ans.values() if len(set(v)) > 1]) == 0:
    print('Yes')
else:
    print('No')
# print(ans)

Submission status: Wrong Answer

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

m = {}
# m2 = {}

# for i in range(len(s)):
#     c1 = s[i]
#     c2 = t[i]
#     if c2 not in m:
#         m[c2] = c1
#     else:

    # if c1 not in m:
    #     m[c1] = c2
    # else:
    #     if m[c1] ==


for i in range(len(s)):
    c1 = s[i]
    c2 = t[i]
    # if c1 == c2:
    #     continue
    # if c1 in m and m[c1] != c2:
    #     print('No!', i, c1, c2)
    #     print(m)
    #     exit()
    if c2 in m and m[c2] != c1:
        print('No')
        exit()
    else:
        # m[c1] = c2
        m[c2] = c1

print('Yes')

Submission status: Wrong Answer

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

m = {}
# m2 = {}

# for i in range(len(s)):
#     c1 = s[i]
#     c2 = t[i]
#     if c2 not in m:
#         m[c2] = c1
#     else:

    # if c1 not in m:
    #     m[c1] = c2
    # else:
    #     if m[c1] ==


for i in range(len(s)):
    c1 = s[i]
    c2 = t[i]
    # if c1 == c2:
    #     continue
    # if c1 in m and m[c1] != c2:
    #     print('No!', i, c1, c2)
    #     print(m)
    #     exit()
    if c2 in m and m[c2] != c1:
        print('No')
        exit()
    else:
        # m[c1] = c2
        m[c2] = c1

print(m)

print('Yes')

Submission status: Wrong Answer

Solution code:
s=input()
t=input()
ds={}
dt={}
l=[]
for i in range(len(s)):
  if s[i]!=t[i]:
    if t[i] not in dt:
      dt[t[i]]=0
    if s[i] not in ds:
      ds[s[i]]=0
    else:
      if t[i] not in dt:
        print('No') 
  else:
    if s[i] in ds or s[i] in dt:
      print('No')
      exit()
print('Yes')

Submission status: Wrong Answer

Solution code:
s=input()
t=input()
ds={}
dt={}
l=[]
for i in range(len(s)):
  if s[i]!=t[i]:
    if t[i] not in dt:
      dt[t[i]]=0
    if s[i] not in ds:
      ds[s[i]]=0
  else:
    if s[i] in ds or s[i] in dt:
      print('No')
      exit()
print('Yes')

Submission status: Wrong Answer

Solution code:
s=input()
t=input()
d={}
l=[]
for i in range(len(s)):
  if s[i]==t[i]:
    if s[i] not in d:
      d[s[i]]=0
  l.append([s[i],t[i]])
l.sort()
for i in range(len(s)):
  if s[i]!=t[i]:
    if t[i] in d:
      print('No')
      exit()
for i in range(len(l)-1):
  if l[i][0]==l[i+1][0]:
    if l[i][1]!=l[i+1][1]:
      print('No')
      exit()
print('Yes')

Submission status: Wrong Answer

Solution code:
s=input()
t=input()
d={}
for i in range(len(s)):
  if s[i]==t[i]:
    if s[i] not in d:
      d[s[i]]=0
for i in range(len(s)):
  if s[i]!=t[i]:
    if t[i] in d:
      print('No')
      exit()
print('Yes')

Submission status: Wrong Answer

Solution code:
import sys, math
def input():
    return sys.stdin.readline()[:-1]
from itertools import permutations, combinations
from collections import defaultdict, Counter
d = defaultdict(int)

sys.setrecursionlimit(10**7)
S = input()
T = input()

set_dif = set()

for s, t in zip(S, T):
    if s != t:
        set_dif.add(s)
        set_dif.add(t)

for s, t in zip(S, T):
    if s == t:
        if s in set_dif or t in set_dif:
            print('No')
            exit()
else:
    print('Yes')

Submission status: Wrong Answer

Solution code:
import sys, math
def input():
    return sys.stdin.readline()[:-1]
from itertools import permutations, combinations
from collections import defaultdict, Counter
d = defaultdict(int)

sys.setrecursionlimit(10**7)
S = input()
T = input()

set_dif = set()

for s, t in zip(S, T):
    if s == t:
        if s in set_dif or t in set_dif:
            print('No')
            exit()
    else:
        set_dif.add(s)
        set_dif.add(t)
else:
    print('Yes')

Submission status: Wrong Answer

Solution code:

S = input()
T = input()

if len(S) != len(T):
  print("No")
  exit()

d = {}
  
for i in range(len(T)):
  if T[i] in d:
    d[T[i]].append(S[i])
  else:
    d[T[i]] = [S[i]]


for key, val in d.items():
  if len(val) >= 2:
    r = set()
    for v in val:
      r.add(v)

    if len(r) >= 2:
      print("No")
      exit()

print("Yes")

Submission status: Wrong Answer

Solution code:

S = input()
T = input()

abc = {}
  
for i in range(len(T)):
  if T[i] in abc:
    abc[T[i]].append(i)
  else:
    abc[T[i]] = [i]

for key, value in abc.items():
  if len(value) >= 2:
    x = set()
    for v in value:
      x.add(S[v])
    if len(x) >= 2:
      print("No")
      exit()

print("Yes")

Submission status: Wrong Answer

Solution code:

S = input()
T = input()

abc = {}

if len(S) != len(T):
  print("No")
  exit()
  
for i in range(len(T)):
  if T[i] in abc:
    abc[T[i]].append(i)
  else:
    abc[T[i]] = [i]

for key, value in abc.items():
  if len(value) >= 2:
    x = set()
    for v in value:
      x.add(S[v])
    if len(x) >= 2:
      print("No")
      exit()

print("Yes")

Submission status: Wrong Answer

Solution code:
S = input()
T = input()
alphabet_pairs = [None] * 26

def convert_alphabet_to_int(s):
  return ord(s) - ord('a')

# ペアの要素が別の文字位置でも成り立たない箇所が1つでもあれば終了
for i, s in enumerate(S):
  t = T[i]
  int_s = convert_alphabet_to_int(s)
  int_t = convert_alphabet_to_int(t)
  alphabet_pairs[int_s] = int_t
  alphabet_pairs[int_t] = int_s
print(alphabet_pairs)
new_T = ''
for i, s in enumerate(S):
  string = chr(ord('a') + alphabet_pairs[convert_alphabet_to_int(s)])
  print(string)
  new_T += string
print(new_T, T)
print(len(new_T), len(T))
if new_T == T:
  print('Yes')
else:
  print('No')

Submission status: Wrong Answer

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
sabc[s[-1]]=count
count=1
for i in range(n-1):
  if t[i]==t[i+1]:
    count+=1
  else:
    tabc[t[i]]=count
    count=1
tabc[t[-1]]=count

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

Submission status: Wrong Answer

Solution code:
s=list(input())
t=list(input())
ss=len(set(s))
tt=len(set(t))

l=[]
for i,j in zip(s,t):
    l.append(i+j)
print(l)
if len(set(l)) == ss == tt:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
s=list(input())
t=list(input())
ss=len(set(s))

l=[]
for i,j in zip(s,t):
    l.append(i+j)

if len(set(l)) == ss:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

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]
S.sort()
T.sort()
diffS = 0
diffT = 0
countS = 1
countT = 1
Sc = []
Tc = []
for i in range(len(S)-1) :
    if S[i] != S[i+1] :
        diffS += 1
        Sc.append(countS)
        countS = 1
    else :
        countS+=1
for i in range(len(T)-1) :
    if T[i] != T[i+1] :
        diffT += 1
        Tc.append(countT)
        countT = 1
    else :
        countT = 1
Sc.sort()
Tc.sort()
ans = "Yes"
if diffS != diffT :
    ans = "No"
else :
    for i in range(len(Tc)) :
        if Tc[i] != Sc[i] :
            ans = "No"
            break
print(ans)

Submission status: Wrong Answer

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]
S.sort()
T.sort()
diffS = 0
diffT = 0
for i in range(len(S)-1) :
    if S[i] != S[i+1] :
        diffS += 1
for i in range(len(T)-1) :
    if T[i] != T[i+1] :
        diffT += 1
ans = "Yes"
if diffS != diffT :
    ans = "No"
print(ans)

Submission status: Wrong Answer

Solution code:
s = input()
t = input()
##任意の置換が可能
if len(s)!=len(t):
    print("No")
    exit()

l = len(s)

chng = {}

for i in range(l):
    if s[i] in chng:
        if chng[s[i]]!=t[i]:
            print("No")
            exit()
    else:#この置換のみ考えればよい
        chng[s[i]] = t[i]
        #これだとt[i]重複の可能性あり
if len(set(s))!= len(chng.items()):#上のちぇっく
    print("No")
    exit()
    
print("Yes")

Submission status: Wrong Answer

Solution code:
s = input()
t = input()
##任意の置換が可能
if len(s)!=len(t):
    print("No")
    exit()
##s中に出てくる文字以外に置換できない
if set(s)!=set(t):
    print("No")
    exit()
l = len(s)

chng = {}

for i in range(l):
    if s[i] in chng:
        if chng[s[i]]!=t[i]:
            print("No")
            exit()
    else:#この置換のみ考えればよい
        chng[s[i]] = t[i]
    
print("Yes")

Submission status: Wrong Answer

Solution code:
s = input()
t = input()
##任意の置換が可能
if len(s)!=len(t):
    print("No")
    exit()
l = len(s)

chng = {}

for i in range(l):
    if s[i] in chng:
        if chng[s[i]]!=t[i]:
            print("No")
            exit()
    else:#この置換のみ考えればよい
        chng[s[i]] = t[i]
    
print("Yes")

Submission status: Wrong Answer

Solution code:
s = input()
t = input()
l = []
for i in range(len(s)):
  if s[i] == t[i]:
    l.append(t[i])
for i in range(len(s)):
  if s[i] != t[i] and t[i] in l:
    print("No")
    exit()
print("Yes")

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python3
import sys

YES = "Yes"  # type: str
NO = "No"  # type: str


def solve(S: str, T: str):

    table = {}
    for i in range(len(T)):
        if table.get(T[i]) == None:
            table[T[i]] = [i]
        else:
            table[T[i]].append(i)
    
    for _,value in table.items():
        a = set([S[i] for i in value])
        if len(a) > 1:
            print(NO)
            return
    else:
        print(YES)
    return


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    S = next(tokens)  # type: str
    T = next(tokens)  # type: str
    solve(S, T)

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
S = list(input())
T = list(input())
ans = 'Yes'
d = {chr(_): 0 for _ in range(97,97+26)}
for i in range(len(S)):
    if d[T[i]] == 0:
        d[T[i]] = S[i]
    elif d[T[i]] != S[i]:
        ans = 'No'
        break
print(ans)

Submission status: Wrong Answer

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

SS = sorted(list(S))
TT = sorted(list(T))
SSS = []
TTT = []
numS = 0
numT = 0
checkS = 1
checkT = 1

for i in range(len(S)-1):
    if SS[i] != SS[i+1]:
        if numS < checkS:
            numS = checkS
        SSS.append(numS)
        checkS = 1
    elif i == len(S)-2:
        SSS.append(numS)
    else:
        checkS += 1

    if TT[i] != TT[i+1]:
        if numT < checkT:
            numT = checkT
        TTT.append(numT)
        checkT = 1
    elif i == len(S)-2:
        TTT.append(numT)
    else:
        checkT += 1
SSS.sort()
TTT.sort()
if SSS == TTT:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

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

SS = sorted(list(S))
TT = sorted(list(T))
SSS = []
TTT = []
numS = 0
numT = 0
checkS = 1
checkT = 1

for i in range(len(S)-1):
    if SS[i] != SS[i+1]:
        if numS < checkS:
            numS = checkS
        SSS.append(numS)
        checkS = 1
    elif i == len(S)-1:
        SSS.append(numS)
    else:
        checkS += 1

    if TT[i] != TT[i+1]:
        if numT < checkT:
            numT = checkT
        TTT.append(numT)
        checkT = 1
    elif i == len(S)-1:
        TTT.append(numT)
    else:
        checkT += 1
SSS.sort()
TTT.sort()
if SSS == TTT:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
import collections
s = input()
t = input()
dd = collections.defaultdict(str)
for i in range(len(s)):
    if dd[t[i]] == '':
        dd[t[i]] = s[i]
    if dd[t[i]] != '' and dd[t[i]] != s[i]:
        print('No')
        exit()
print('Yes')

Submission status: Wrong Answer

Solution code:
from collections import defaultdict
S = input()
T = input()
ans = "Yes"
s_dict = defaultdict(str)
# SとTが互いに単射であればYesそうでなければNo
for s,t in zip(S,T):
  if s_dict[t] != "" and s_dict[t] != s:
    ans = "No"
    break
  s_dict[t] = s
print(ans)

Submission status: Wrong Answer

Solution code:
from collections import defaultdict
from collections import Counter
S = input()
T = input()
ans = "Yes"
s_dict = defaultdict(set)
t_dict = defaultdict(set)
# SとTが互いに単射であればYesそうでなければNo
for s,t in zip(S,T):
  s_dict[t].add(s)
  t_dict[s].add(t)
mode_s = len(Counter(s_dict).most_common(1)[0][1])
mode_t = len(Counter(t_dict).most_common(1)[0][1])
if mode_s > 1 or mode_t > 1:
  ans = "No"
print(ans)

Submission status: Wrong Answer

Solution code:
import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
from collections import Counter

s, t = readline(), readline()
sc, tc = list(Counter(s).values()), list(Counter(t).values())
print('Yes' if sc == tc else 'No')

Submission status: Wrong Answer

Solution code:
S = input()
T = input()
ans = "Yes"
for s,t in zip(S,T):
  if s != t:
    index = S.find(t)
    if index == -1:
      continue
    if S[index] == T[index]:
      ans = "No"
print(ans)

Submission status: Wrong Answer

Solution code:
import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
from collections import Counter

s, t = readline(), readline()
sc, tc = list(Counter(s).values()), list(Counter(s).values())
print('Yes' if sc == tc else 'No')

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-

import sys

def input(): return sys.stdin.readline().strip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e): return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]
def ceil(x, y=1): return int(-(-x // y))
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(N=None): return list(MAP()) if N is None else [INT() for i in range(N)]
def Yes(): print('Yes')
def No(): print('No')
def YES(): print('YES')
def NO(): print('NO')
sys.setrecursionlimit(10 ** 9)
INF = 10 ** 18
MOD = 10 ** 9 + 7

S = input()
T = input()
N = len(S)

same = set()
for i in range(N):
    s = S[i]
    t = T[i]
    if s == t:
        same.add(s)
for i in range(N):
    s = S[i]
    t = T[i]
    if (s in same or t in same) and s != t:
        No()
        exit()
Yes()

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-

import sys
from collections import Counter

def input(): return sys.stdin.readline().strip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e): return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]
def ceil(x, y=1): return int(-(-x // y))
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(N=None): return list(MAP()) if N is None else [INT() for i in range(N)]
def Yes(): print('Yes')
def No(): print('No')
def YES(): print('YES')
def NO(): print('NO')
sys.setrecursionlimit(10 ** 9)
INF = 10 ** 18
MOD = 10 ** 9 + 7

S = input()
T = input()
N = len(S)

C = Counter(S)
d = {}
for i in range(N):
    s = S[i]
    t = T[i]
    if s in d:
        s = d[s]
    if s == t:
        continue
    # sが他の所で競合しないか
    if C[s] >= 2 and s in d and d[s] != t:
        No()
        exit()
    # tが他の所で競合しないか
    if C[t] >= 1 and t in d and d[t] != s:
        No()
        exit()
    d[t] = s
    d[s] = t
    C[s] -= 1
    C[t] += 1
Yes()

Submission status: Wrong Answer

Solution code:
import sys
import numpy as np
input = sys.stdin.readline
A = list(input())
B = list(input())
N = len(A)
change_ = [[0] * 26 for _ in range(26)]
change__ = [[0] * 26 for _ in range(26)]
alpha2num = lambda c: ord(c) - ord("a")
for i, j in zip(A, B):
    if i != j:
        change_[alpha2num(i)][alpha2num(j)] += 1
change_ = np.array(change_)
for i, j in zip(B, A):
    if i != j:
        change__[alpha2num(i)][alpha2num(j)] += 1
change__ = np.array(change__)
for k in change_:
    if np.count_nonzero(k) > 1:
        print("No")
        sys.exit()
for k in change__:
    if np.count_nonzero(k) > 1:
        print("No")
        sys.exit()
print("Yes")

Submission status: Wrong Answer

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

d = {}

c = 0
for i in range(len(s)):
  if s[i] not in d:
    d[s[i]] = c
    c += 1

d_ = {}
for i in range(len(t)):
  if t[i] not in d_:
    d_[t[i]] = d[s[i]]

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

Submission status: Wrong Answer

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

d = {}

c = 0
for i in range(len(s)):
  if s[i] not in d:
    d[s[i]] = c
    c += 1

d_ = {}
for i in range(len(t)):
  if t[i] not in d_:
    d_[t[i]] = d[s[i]]

s_ = ''
for i in range(len(s)):
  s_ += str(d[s[i]])

t_ = ''
for i in range(len(t)):
  t_ += str(d_[t[i]])

if s_ == t_:
  print('Yes')
else:
  print('No')

Submission status: Wrong Answer

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


alphabet_list = [[]for i in range(26)]

for i in range(len(s)):
    if s[i] == t[i]:
        continue
    if t[i] not in alphabet_list[ord(s[i])-97]:
        alphabet_list[ord(s[i])-97].append(t[i])
    elif t[i] in alphabet_list[ord(s[i])-97]:
        continue
    else:
        print('No')
        exit()

for i in range(25):
    for j in range(i+1, 26):
        if alphabet_list[i] == [] or alphabet_list[j] == []:
            continue
        elif alphabet_list[i] == alphabet_list[j]:
            print('No')
            exit()

print('Yes')

Submission status: Wrong Answer

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

alphabet_list = [[]for i in range(26)]

for i in range(len(s)):
    if s[i] == t[i]:
        continue
    if t[i] not in alphabet_list[ord(s[i])-97]:
        alphabet_list[ord(s[i])-97].append(t[i])
    elif t[i] in alphabet_list[ord(s[i])-97]:
        continue
    else:
        print('No')
        exit()

for i in range(25):
    for j in range(i, 26):
        if alphabet_list[i] == alphabet_list[j] and alphabet_list[i] is True and alphabet_list[j] is True:
            print('No')
            exit()

print('Yes')

Submission status: Wrong Answer

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

alphabet_list = [[]for i in range(26)]

for i in range(len(s)):
    if s[i] == t[i]:
        continue
    if t[i] not in alphabet_list[ord(s[i])-97]:
        alphabet_list[ord(s[i])-97].append(t[i])
    elif t[i] in alphabet_list[ord(s[i])-97]:
        continue
    else:
        print('No')
        exit()

for i in range(25):
    for j in range(i, 26):
        if alphabet_list[i] == alphabet_list[j]:
            print('No')
            exit()

print('Yes')

Submission status: Wrong Answer

Solution code:
import collections

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

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

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

Submission status: Wrong Answer

Solution code:
import sys
s=input()
t=input()
n=len(s)-1
d=dict()
d2=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]
    
    if s[i] in d2.keys():
        if d2[s[i]] != t[i]:
            print("No")
            sys.exit()
    else:
        d2[s[i]] = t[i]
else:
    print("Yes")

Submission status: Wrong Answer

Solution code:
print("Yes")

Submission status: Wrong Answer

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: Wrong Answer

Solution code:
from collections import defaultdict
ans = "Yes"
S = list(input() for i in range(2))
d = defaultdict(lambda:"")
for i in range(len(S[0])):
    if d[S[1][i]]=="":
        d[S[1][i]]=S[0][i]
    elif d[S[1][i]]!=S[0][i]:
        ans = "No"
        break
print(ans)