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:
S=input()
T=input()
pp=[]
for i in range(97,123):
  pp.append(i)
na=97
ans='Yes'
for i in range(len(S)):
  if pp[ord(S[i])-na]==ord(S[i]):
    pp[ord(S[i])-na]=ord(T[i])
    pp[ord(T[i])-na]=ord(S[i])
  else:
    if pp[ord(S[i])-na]==ord(T[i]):
      pass
    else:
      ans='No'
      break
if len(pp)!=len(set(pp)):
  ans='No'
print(ans)

Submission status: Wrong Answer

Solution code:
S=input()
T=input()
pp=[]
for i in range(97,123):
  pp.append(i)
na=97
ans='Yes'
for i in range(len(S)):
  if pp[ord(S[i])-na]==ord(S[i]):
    pp[ord(S[i])-na]=ord(T[i])
  else:
    if pp[ord(S[i])-na]==ord(T[i]):
      pass
    else:
      ans='No'
      break
if len(pp)!=len(set(pp)):
  ans='No'
print(ans)

Submission status: Wrong Answer

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

for i in range(len(s)):
  if s[i] != t[i]:
    if 0 <= s.find(t[i]) < i:
      print('No')
      exit(0)
  s = s.replace(s[i], 'X').replace(t[i], s[i]).replace('X', t[i])
    
print('Yes')

Submission status: Wrong Answer

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

s2 = []
t2 = []

sdic = {}
tdic = {}

cnt = 0
for c in s:
    if c in sdic:
        s2.append(sdic[c])
    else:
        s2.append(cnt)
        sdic[c] = cnt
        cnt += 1

cnt = 0
for c in t:
    if c in tdic:
        t2.append(tdic[c])
    else:
        t2.append(cnt)
        tdic[c] = cnt
        cnt += 1
        
print(s2)
print(t2)

print("Yes" if s2 == t2 else "No")

Submission status: Wrong Answer

Solution code:
from collections import defaultdict
S = input()
T = input()
d1 = defaultdict(int)
d2 = defaultdict(int)
for i in range(len(S)):
    d1[S[i]] += 1
    d2[T[i]] += 1

if list(d1.values())==list(d2.values()):
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

Solution code:
s = list(input())
t = list(input())
n = len(s)
atoz = [chr(i) for i in range(97, 97+26)]
rs = [-1]*26
rt = [-1]*26
for i in range(n):
  if rs[atoz.index(s[i])] != -1 or rt[atoz.index(t[i])] != -1:
    if rs[atoz.index(s[i])] != s[i] or rt[atoz.index(t[i])] != t[i]:
      print("No")
      break
  else:
    rs[atoz.index(s[i])] = t[i]
    rt[atoz.index(t[i])] = s[i]
else:
  print("Yes")

Submission status: Wrong Answer

Solution code:
s = list(input())
t = list(input())
n = len(s)
atoz = [chr(i) for i in range(97, 97+26)]
rs = [-1]*26
rt = [-1]*26
for i in range(n):
  if rs[atoz.index(s[i])] != -1 or rt[atoz.index(t[i])] != -1:
    if rs[atoz.index(s[i])] != s[i] or rt[atoz.index(t[i])] != t[i]:
      print("No")
      break
  else:
    rs[atoz.index(s[i])] = s[i]
    rt[atoz.index(t[i])] = t[i]
else:
  print("Yes")

Submission status: Wrong Answer

Solution code:
def submit():
    s = input().strip()
    t = input().strip()

    # sとtに重複文字がない場合はいつでも変換可能
    if not set(list(s)) & (set(list(t))):
        print("Yes")
        return
    
    # 変換ペアを作成した際に
    # 重複した変換先がなければ変換可能
    check = {}
    for se, te in zip(s, t):
        if te in check.keys() and check[te] != se:
            print("No")
            return
        else:
            check[te] = se
    print("Yes")


if __name__ == "__main__":
    submit()

Submission status: Wrong Answer

Solution code:

def submit():
    s = input().strip()
    t = input().strip()

    # 変換ペアを作成した際に
    # 重複した変換先がなければOK
    check = {}
    for se, te in zip(s, t):
        if te in check.keys() and check[te] != se:
            print("No")
            return
        else:
            check[te] = se
    print("Yes")


if __name__ == "__main__":
    submit()

Submission status: Wrong Answer

Solution code:
s = list(input())
t = list(input())
n = len(s)
flag = 0
ans = "YNeos"
for i in range(n):
  if s[i] != t[i]:
    flag += 1
print(ans[::2]) if flag % 2 == 0 else print(ans[1::2])

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
S = str(input())
T = str(input())
alp = "abcdefghijklmnopqrstuvwxyz"
for i in range(0,len(S)//2):
  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: Wrong Answer

Solution code:
import sys
import math
mod=10**9+7
inf=float("inf")
from math import sqrt
from collections import deque
from collections import Counter
input=lambda: sys.stdin.readline().strip()
sys.setrecursionlimit(11451419)
from functools import lru_cache
#メモ化再帰defの冒頭に毎回 @lru_cache(maxsize=10**10)
#引数にlistはだめ
#######ここまでテンプレ#######
#######ここから天ぷら########
s=list(input())
t=list(input())
for al in ["a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","x","w","x","y","z"]:
    num=[nu for nu,chra in enumerate(s) if chra==al]
    if not len(set([t[i] for i in num])) in [0,1]:
        print("No")
        exit()
print("Yes")

Submission status: Wrong Answer

Solution code:
s1=str(input())
s2=str(input())
i=0
ns1=s1
ns2=s2

for c in s1:
    #print(c.isalpha())
    if i==26:
        break
    if c.isalpha():
        #print(c)
        ns1=ns1.replace(c,str(i))
        i+=1

i=0
for c in s2:
    #print(c.isalpha())
    if i==26:
        break
    if c.isalpha():
        #print(c)
        ns2=ns2.replace(c,str(i))
        i+=1
#print(ns1)
#print(ns2)
if ns1==ns2:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
S=list(input())
T=list(input())
if len(set(S))==len(set(T)):
    bufs,buft='',''
    cnts,cntt=1,1
    for i in range(len(S)):
        if bufs!=S[i]: bufs=S[i]; cnts=1
        else: cnts+=1
        if buft!=T[i]: buft=T[i]; cntt=1
        else: cntt+=1
        if cnts!=cnts: print('No'); exit()
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

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

li1 = list("abcdefghijklmnopqrstuvwxyz")
li2 = {}
for i in range(26):
    li2[li1[i]] = [li1[i],0]

for i in range(len(s)):
    
    if li2[s[i]][0] == t[i]:
        li2[s[i]][1] = 1
        continue
    elif li2[s[i]][1]==0:
        li2[s[i]][0] = t[i]
        li2[t[i]][0] = s[i]
        li2[t[i]][1] = 1
        li2[s[i]][1] = 1
        # print(s[i],t[i])
    else:
        print("No")
        break
else:
    print("Yes")

# print(li2)

Submission status: Wrong Answer

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

li1 = list("abcdefghijklmnopqrstuvwxyz")
li2 = {}
for i in range(26):
    li2[li1[i]] = [li1[i],0]

for i in range(len(s)):
    if s[i] == t[i]:
        continue
    else:
        if li2[s[i]][0] == t[i]:
            continue
        elif li2[s[i]][1]==0:
            li2[s[i]][0] = t[i]
            li2[s[i]][1] = 1
        else:
            print("No")
            break
else:
    print("Yes")

Submission status: Wrong Answer

Solution code:
s = list(input())
t = list(input())
S,T = set(s),set(t)
sl = tl = []
for i in S:
    sl.append([j for j, x in enumerate(s) if x == i])

for i in T:
    tl.append([j for j, x in enumerate(t) if x == i])

if sorted(sl)==sorted(tl):print('Yes')
else:print('No')

Submission status: Wrong Answer

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

Sc=[[] for i in range(26)]
Tc=[[] for i in range(26)]

for i in range(len(S)):
    Sc[ord(S[i])-97].append(i)
for i in range(len(S)):
    Tc[ord(T[i])-97].append(i)
print(Sc)
print(Tc)

for i in range(len(S)):
    if(Sc[ord(S[i])-97]!=Tc[ord(T[i])-97]):
        print("No")
        exit()
print("Yes")

Submission status: Wrong Answer

Solution code:
s = str(input())
t = str(input())
s_list = list(s)
t_list = list(t)
s_list.sort()
t_list.sort()
if len(set(s_list)) != len(set(t_list)):
    print("No")
else:
    print("Yes")

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
s = list(input())
t = list(input())
if len(set(s)) == len(set(t)):
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

Solution code:
def main():
    S=input()
    T=input()
    X=[]
    Y=[]
    flag=False
    for i in range(len(S)):
        al=False
        if T[i] in Y:
            al=True
            if X[Y.index(T[i])]!=S[i]:
                flag=False
                break
        if S[i] in X:
            al=True
            if Y[X.index(S[i])]!=T[i]:
                flag=False
                break
        if al==False:
            X.append(S[i])
            Y.append(T[i])
    if flag:
        print("Yes")

if __name__=="__main__":
    main()

Submission status: Wrong Answer

Solution code:
def main():
    S=input()
    T=input()
    li=[]
    flag=True
    for i in range(len(S)):
        if S[i] in li:
            if T[i]!=S[i]:
                flag=False
                print("No")
                break
        if T[i] in li:
            if T[i]!=S[i]:
                flag=False
                print("No")
                break
        if T[i] not in li:
            li.append(T[i])
        
    if flag:
        print("Yes")

if __name__=="__main__":
    main()

Submission status: Wrong Answer

Solution code:
# 2020/02/29
# AtCoder Regular Contest 029 - B

# Input
s = input()
t = input()
slist = [0] * 26
tlist = [0] * 26
n = len(s)
for i in range(n):
    slist[ord(s[i])-97] += 1
    tlist[ord(t[i])-97] += 1

slist.sort()
slist.reverse()
tlist.sort()
tlist.reverse()

scnt = 0
tcnt = 0
for i in range(n):
    if slist[i] == 0:
        break
    scnt += 1

for i in range(n):
    if tlist[i] == 0:
        break
    tcnt += 1

if abs(tcnt - scnt) <= 2:
    ans = "Yes"
else:
    ans = "No"

# Output
print(ans)

Submission status: Wrong Answer

Solution code:
import sys
s = str(input())
t = str(input())
l = len(s)
'''
if set(s)!= set(t):
    print('No')
    sys.exit()
'''
tmp = [[], []]
for i in range(l):
    if (not s[i] in tmp[0]) and (not t[i] in tmp[1]):
        tmp[0].append(s[i])
        tmp[1].append(t[i])
    elif s[i] in tmp[0] and t[i] in tmp[1]:
        continue
    else:
        print('No')
        sys.exit()
print('Yes')

Submission status: Wrong Answer

Solution code:
# https://atcoder.jp/contests/abc110/tasks/abc110_c
# 文字のカウント数についてその種類が同じならばYes

S = input()
T = input()

from collections import Counter
s_cnt = Counter(S)
t_cnt = Counter(T)

if set(s_cnt.values()) == set(t_cnt.values()):
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

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


for i in range(len(s)):
    c1 = s[i]
    c2 = t[i]
    if c1 == c2:
        for j in range(len(b)):
            if b[j][0] == c1:
                print("No")
                print(c1)
                exit()
else:
    print("Yes")

Submission status: Wrong Answer

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)):
    c1 = s[i]
    c2 = t[i]
    if s[i] == t[i]:
        for j in range(len(b)):
            if b[j][0] == c1:
                print("No")
                exit()
    if s[i] != t[i]:
        for j in range(len(b)):
            if b[j][1] == c2 and b[j][0] != c1:
                print("No")
                exit()
            if b[j][1] != c2 and b[j][0] == c1:
                print("No")
                exit()
            if b[j][1] == c2 and b[j][0] == c1:
                break
        else:
            a.remove(c2)
            b.append([c1, c2])
else:
    print("Yes")

Submission status: Wrong Answer

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]
        for j in range(len(b)):
            if b[j][1] == c2 and b[j][0] != c1:
                print("No")
                exit()
            if b[j][1] != c2 and b[j][0] == c1:
                print("No")
                exit()
            if b[j][1] == c2 and b[j][0] == c1:
                break
        else:
            a.remove(c2)
            b.append([c1, c2])
else:
    print("Yes")

Submission status: Wrong Answer

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

swich=[]
stay=[]
for x,y in zip(s,t):
    if x!=y:
        swich.append([x,y])
    else:
        stay.append(x)
#print(swich,stay,sep=('\n'))
for i in swich:
    if i[0] in stay or i[1] in stay:
        print('No')
        exit()
    for j in swich:
        if i[0]==j[0] and i[1]!=j[1]:
            print('No')
            exit()


print('Yes')

Submission status: Wrong Answer

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

d = dict()
for i in range(len(S)):
    s, t = S[i], T[i]
    if d.get(s) is None:
        d[s] = t
        d[t] = s
    else:
        if d[s] != t:
            print('No')
            break
else:
    print('Yes')

Submission status: Wrong Answer

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

d = dict()
for i in range(len(S)):
    s, t = S[i], T[i]
    if d.get(s) is None:
        d[s] = t
    else:
        if d[s] != t:
            print('No')
            break
else:
    print('Yes')

Submission status: Wrong Answer

Solution code:
from collections import defaultdict
d = defaultdict(str)
k = defaultdict(str)

S = input()
T = input()

ans = "Yes"

for i in range(len(S)):
  if S[i] == T[i]:
    continue

  if d[S[i]] and d[S[i]] != T[i]:
    ans = 'No'
    break

  if k[T[i]] and k[T[i]] != S[i]:
    ans = 'No'
    break

  d[S[i]] = T[i]
  k[T[i]] = S[i]

print(ans)

Submission status: Wrong Answer

Solution code:
from collections import defaultdict
d = defaultdict(str)

S = input()
T = input()

ans = "Yes"

for i in range(len(S)):
  if S[i] == T[i]:
    continue

  d[S[i]] = T[i]

li = []

for i in d:
  if i in li:
    ans = 'No'
    break

  li.append(i)
  
li = []
  
for i in d:
  if d[i] in li:
    ans = 'No'
    break
    
  li.append(d[i])

print(ans)

Submission status: Wrong Answer

Solution code:
from collections import defaultdict
d = defaultdict(str)
s = defaultdict(int)

S = input()
T = input()

ans = "Yes"

for i in range(len(S)):
  if S[i] == T[i]:
    continue

  d[S[i]] = T[i]

for i in d:
  s[d[i]] += 1

for i in s:
  if s[i] > 1:
    ans = 'No'
    
print(ans)

Submission status: Wrong Answer

Solution code:
print("Yes")if len(set(input()))==len(set(input())) else print("No")

Submission status: Wrong Answer

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

ts = {t: set() for t in T}
for i in range(len(S)):
    ts[T[i]].add(S[i])

for v in ts.values():
    if len(v) > 1:
        print('No')
        break
else:
    print('Yes')

Submission status: Wrong Answer

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")
    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] or u[i][0]!=u[i+1][0] and u[i][1]==u[i+1][1]:
            ans="No"
            break       
print(ans)

Submission status: Wrong Answer

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")
    #print(u)
    #print(v)
    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: Wrong Answer

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)
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
print(ans)

Submission status: Wrong Answer

Solution code:
from collections import defaultdict
s=input()
S={}
S1=set([])
S2=set([])
t=input()
T={}
T1=set([])
T2=set([])
for i in range(len(s)):
    if s[i] in S1:
        S2.add(i)
        S2.add(S[s[i]])
    else:
        S1.add(s[i])
        S[s[i]]=i
    if t[i] in T1:
        T2.add(i)
        T2.add(T[t[i]])
    else:
        T1.add(t[i])
        T[t[i]]=i
print('Yes' if S2==T2 else 'No')

Submission status: Wrong Answer

Solution code:
from collections import Counter
s = list(input())
t = list(input())

sc = Counter(s)
tc = Counter(t)

sc_l = sorted([sc[x] for x in sc.values()])
tc_l = sorted([tc[x] for x in tc.values()])

ans = True
if len(sc) != len(tc):
    print("No")
else:
    for i in range(len(sc)):
        if sc_l[i] != tc_l[i]:
            ans = False
            break
    if ans:
        print("Yes")
    else:
        print("No")

Submission status: Wrong Answer

Solution code:
from collections import Counter
s = list(input())
t = list(input())

sc = Counter(s)
tc = Counter(t)

sc_l = [sc[x] for x in sc.values()]
tc_l = [tc[x] for x in tc.values()]

ans = True
if len(sc) != len(tc):
    print("No")
else:
    for i in range(len(sc)):
        if sc_l[i] != tc_l[i]:
            ans = False
            break
    if ans:
        print("Yes")
    else:
        print("No")

Submission status: Wrong Answer

Solution code:
input1 = input()
input2 = input()
flag = 'Yes'

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

Submission status: Wrong Answer

Solution code:
import sys
input1 = 'abcdefghijklmnopqrstuvwxyz'
input2 = 'ibyhqfrekavclxjstdwgpzmonu'

input1 = 'chokudai'
input2 = 'redcoder'

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

Submission status: Wrong Answer

Solution code:
import collections

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

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

if len(ss.values()) != len(tt.values()):
    print("No")
else:
    print("Yes")

Submission status: Wrong Answer

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

Solution code:
def f():
  s = input()
  return [s.count(c) for c in 'abcdefghijklmnopqrstuvwxyz']
ls,lt = f(),f()
d = {}
for i in range(26):
  if ls[i] != lt[i]:
    l,r = sorted([ls[i],lt[i]])
    k = l*100+r
    d[k] = d.get(k,0)+1
print('YNeos'[any(i<2 for i in d.values())::2])

Submission status: Wrong Answer

Solution code:
def f():
  s = input()
  return [s.count(c) for c in 'abcdefghijklmnopqrstuvwxyz']
ls,lt = f(),f()
d = {}
for i in range(26):
  if ls[i] != lt[i]:
    l,r = sorted([ls[i],lt[i]])
    k = l*100+r
    d[k] = d.get(k,0)+1
print('YNeos'[any(i%2 for i in d.values())::2])

Submission status: Wrong Answer

Solution code:
s = input()
t = input()
dic = {}
for ss,tt in zip(s,t):
    if (ss not in dic) or (tt not in dic):
        if ss not in dic:
            dic[ss] = tt
        if tt not in dic:
            dic[tt] = ss
    if dic[ss] != tt or dic[tt] != ss:
        print('No')
        exit()
print('Yes')

Submission status: Wrong Answer

Solution code:
s = input()
t = input()
dic = {}
for ss,tt in zip(s,t):
    if (ss not in dic) or (tt not in dic):
        if ss not in dic:
            dic['ss'] = tt
        if tt not in dic:
            dic['tt'] = ss
    if dic['ss'] != tt or dic['tt'] != ss:
        print('No')
        exit()
print('Yes')

Submission status: Wrong Answer

Solution code:
s = input()
t = input()
dic = {}
for ss,tt in zip(s,t):
    if ss not in dic:
        dic['ss'] = tt
    else:
        dic['ss'] != tt
        print('No')
        exit()
print('Yes')

Submission status: Wrong Answer

Solution code:
s = input()
t = input()
s = sorted(s)
t = sorted(t)
#s = ''.join(sorted(s))
#t = ''.join(sorted(t))
#print(s,t)
for ss,tt in zip(s,t):
    if ss == tt:
        s.remove(ss)
        t.remove(tt)
if len(s) == len(t):
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

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

s_set = set(s)
t_set = set(t)

if len(s_set) == len(t_set):
  print('Yes')
else:
  print('No')

Submission status: Wrong Answer

Solution code:
import collections


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

sa=list(s)
ta=list(t)

asa=collections.Counter(sa)
ata=collections.Counter(ta)

casa=[i[0] for i in asa.items() if i[1] >= 2]

cata=[i[0] for i in ata.items() if i[1] >= 2]
#print(casa)
#print(cata)
if casa==[] and cata==[]:
    print("Yes")
    exit()
aans=[]
tans=[]
for i in range(len(sa)):
    if sa[i] in casa:
        aans.append(ta[i])
for i in range(len(ta)):
    if ta[i] in cata:
        tans.append(sa[i])        
if len(set(aans))==len(casa) and len(set(tans))==len(cata):
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
import collections


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

sa=list(s)
ta=list(t)

asa=collections.Counter(sa)
ata=collections.Counter(ta)

casa=[i[0] for i in asa.items() if i[1] >= 2]

cata=[i[0] for i in ata.items() if i[1] >= 2]
#print(casa)
#print(cata)
if casa==[] and cata==[]:
    print("Yes")
    exit()

#for i in range(len(sa)):

Submission status: Wrong Answer

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
if ok:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
import sys
sys.setrecursionlimit(4100000)
import math
import fractions
import bisect

MOD = int(1e9+7)
PI = 3.14159265358979323846264338327950288

'''
1行のint
N, K = map(int, input().split())

1行のstring
S, T = input().split()

1行の整数配列
P = list(map(int,input().split()))

改行ありl
x = []
y = []
for i in range(5):
    x1,y1=[int(i) for i in input().split()]
    x.append(x1)
    y.append(y1)

'''


S = input()
T = input()

s_hash = [0]*28
t_hash = [0]*28

s_next = 0
t_next = 0

s_pattern = ""
t_pattern = ""

for c in S:
    if s_hash[ord(c)-ord("a")] == 0:
        s_next+=1

    s_pattern += str(s_next)
    s_hash[ord(c)-ord("a")] += 1

for c in T:
    if t_hash[ord(c)-ord("a")] == 0:
        t_next+=1

    t_pattern += str(t_next)
    t_hash[ord(c)-ord("a")] += 1

if s_pattern == t_pattern:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
import sys
sys.setrecursionlimit(4100000)
import math
import fractions
import bisect

MOD = int(1e9+7)
PI = 3.14159265358979323846264338327950288

'''
1行のint
N, K = map(int, input().split())

1行のstring
S, T = input().split()

1行の整数配列
P = list(map(int,input().split()))

改行ありl
x = []
y = []
for i in range(5):
    x1,y1=[int(i) for i in input().split()]
    x.append(x1)
    y.append(y1)

'''


S = input()
T = input()

s_hash = [0]*26
t_hash = [0]*26

s_next = 0
t_next = 0

s_pattern = ""
t_pattern = ""

for c in S:
    if s_hash[ord(c)-ord("a")] == 0:
        s_next+=1

    s_pattern += str(s_next)
    s_hash[ord(c)-ord("a")] += 1

for c in T:
    if t_hash[ord(c)-ord("a")] == 0:
        t_next+=1

    t_pattern += str(t_next)
    t_hash[ord(c)-ord("a")] += 1

if s_pattern == t_pattern:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
S = str(input())
T = str(input())
S_d = {}
T_d = {}
for i,j in zip(S,T):
    if i in S_d and j in T_d:
        if S_d[i] == T_d[j]:
            pass
        else:
            print("No")
            break
    else:
        if i in S_d or j in T_d:
            print("No")
            break
        else:
            if S.count(S) == T.count(T):
                S_d[i] = S.count(S)
                T_d[j] = T.count(T)
            else:
                print("No")
                break
        
else:
    print("Yes")

Submission status: Wrong Answer

Solution code:
S = input()
T = input()
R_s = [-1] * 26
R_t = [-1] * 26
ans = 'Yes'

for i in range(len(S)):
  tmpS = ord(S[i]) - 97
  tmpT = ord(T[i]) - 97
  if R_s[tmpS] < 0:
    R_s[tmpS] = tmpT
  elif R_s[tmpS] != tmpT:
    ans = 'No'
  
  if R_t[tmpT] < 0:
    R_t[tmpT] = tmpS
  elif R_t[tmpT] != tmpS:
    ans = False

print(ans)

Submission status: Wrong Answer

Solution code:
S = input()
T = input()
R_s = [-1] * 26
R_t = [-1] * 26
ans = True

for i in range(len(S)):
  tmpS = ord(S[i]) - 97
  tmpT = ord(T[i]) - 97
  if R_s[tmpS] < 0:
    R_s[tmpS] = tmpT
  elif R_s[tmpS] != tmpT:
    ans = False
  
  if R_t[tmpT] < 0:
    R_t[tmpT] = tmpS
  elif R_t[tmpT] != tmpS:
    ans = False

print(ans)

Submission status: Wrong Answer

Solution code:
from heapq import heappush, heappop, heapify
from collections import deque, defaultdict, Counter
import itertools
from itertools import permutations, combinations, accumulate
import sys
import bisect
import string
import math
import time


def I(): return int(input())


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


def S(): return input()


def MS(): return map(str, input().split())


def LI(): return [int(i) for i in input().split()]


def LI_(): return [int(i)-1 for i in input().split()]


def StoI(): return [ord(i)-97 for i in input()]


def ItoS(nn): return chr(nn+97)


def input(): return sys.stdin.readline().rstrip()


def show(*inp, end='\n'):
    if show_flg:
        print(*inp, end=end)


YN = {False: 'No', True: 'Yes'}
MOD = 10**9+7
inf = float('inf')
IINF = 10**10
l_alp = string.ascii_lowercase
u_alp = string.ascii_uppercase
ts = time.time()
# sys.setrecursionlimit(10**6)
nums = ['1', '2', '3', '4', '5', '6', '7', '8', '9', '10']


show_flg = True
show_flg = False


def main():
    s = S()
    t = S()
    s_pos = {k: set() for k in l_alp}
    t_pos = {k: set() for k in l_alp}

    for i in range(len(s)):
        s_pos[s[i]].add(i)
        t_pos[t[i]].add(i)

    for c in l_alp:
        z = s_pos[c].intersection(t_pos[c])
        if len(z) > 0 and (len(z) != len(s_pos[c]) or len(z) != len(t_pos[c])):
            # print(c, z)
            print('No')
            return

    print('Yes')


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

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

G = []
G.append(["zz","zz"])
for i in range(len(S)):
    G.append([S[i],T[i]])

cnt = 0
for i in range(len(G)-1):
    #G = sorted(G, key=itemgetter(0))
    if G[i+1][0] == G[i][0]:
        if G[i+1][1] != G[i][1]:
            cnt +=1
            break
    if G[i+1][1] == G[i][1]:
        if G[i+1][0] != G[i][0]:
            cnt +=1
            break
print('Yes' if cnt == 0 else 'No')

Submission status: Wrong Answer

Solution code:
s=input()
t=input()
ss=set(s)
st=set(t)
dif_s=ss-st
dif_t=st-ss
print(dif_s,dif_t)
if len(dif_s)!=1 or len(dif_t)!=1:
    print('No')
    exit()

for x,y in zip(dif_s,dif_t):
    if s.count(x)-t.count(y)==0:
        print('Yes')
    else:
        print('No')

Submission status: Wrong Answer

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

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


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

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

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


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