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:
s1=input()
s2=input()
s1_s=set(s1)
s2_s=set(s2)
      
if len(s1_s^s2_s)%2 == 0:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
S = input()
T = input()
len_s = len(S)
ok = True
s_dict = {}
for i in range(len_s):
  if S[i] in s_dict and s_dict[S[i]] != T[i]:
    ok = False
    break
  s_dict[S[i]] = T[i]
if ok:
  print('Yes')
else:
  print('No')

Submission status: Wrong Answer

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

ls = []
cnts = []
lt = []
cntt = []
for i in s:
    if i not in ls:
        ls.append(i)
        cnts.append(1)
    else:
        cnts[-1] += 1
for i in t:
    if i not in lt:
        lt.append(i)
        cntt.append(1)
    else:
        cntt[-1] += 1

#print(cnts,cntt)

flag = 0
m = len(cnts) 
if len(cnts) == len(cntt):
    for i in range(m):
        if cnts[i] != cntt[i]:
            flag = 1
else:
    flag = 1
    
if flag == 0:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

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

ls = []
cnts = []
lt = []
cntt = []
for i in s:
    if i not in ls:
        ls.append(i)
        cnts.append(1)
    else:
        cnts[-1] += 1
for i in t:
    if i not in lt:
        lt.append(i)
        cntt.append(1)
    else:
        cntt[-1] += 1

cnts.sort()
cntt.sort()
#print(lt,ls,cnts,cntt)

flag = 0
m = len(cnts) 
if len(cnts) == len(cntt):
    for i in range(m):
        if cnts[i] != cntt[i]:
            flag = 1
else:
    flag = 1
    
if flag == 0:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
import bisect
import heapq
import itertools
import math
import os
import re
import string
import sys
from collections import Counter, deque, defaultdict
from copy import deepcopy
from decimal import Decimal
from fractions import gcd
from functools import lru_cache, reduce
from operator import itemgetter

import numpy as np

if os.getenv("LOCAL"):
    sys.stdin = open("_in.txt", "r")

sys.setrecursionlimit(2147483647)
INF = float("inf")
IINF = 10 ** 18
MOD = 10 ** 9 + 7


S = sys.stdin.readline().rstrip()
T = sys.stdin.readline().rstrip()

table = {}
ok = True
for i, t in enumerate(T):
    if t not in table:
        table[t] = S[i]
    if table[t] != S[i]:
        ok = False
if ok:
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

Solution code:
S = input()
T = input()
flag = True
traslate = [[i, i] for i in range(26)]
use = [False] * 26
for i in range(len(S)):
    si = ord(S[i]) - ord('a')
    ti = ord(T[i]) - ord('a')
    #rint("si: ", si, " ti: ", ti, " tsi: ", traslate[si][1], " tti: ", traslate[ti][1])
    if(traslate[si][1] != ti):
        if(use[si] == False and use[ti] == False):
            traslate[si][1], traslate[ti][1] = traslate[ti][1], traslate[si][1]
            use[si] = True
            use[ti] = True
        else:
            flag = False
#print(traslate)
if(flag):
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

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

ans="Yes"
for _ in range(2):
    trans_table={}
    for i in range(26):
        trans_table[chr(i+97)]=chr(i+97)
    for i in range(len(S)):
        if S[i]!=T[i]:  #文字が異なっていた場合
            #print("S,T",S[i],T[i])
            if trans_table[S[i]]==S[i]: #デフォルトのままの場合
                trans_table[S[i]]=T[i]  #新しい文字に置換
            else:   #既に置換されていた場合
                # これから置換しようとしているのと異なる文字の場合
                if trans_table[S[i]]!=T[i]:
                    ans='No'    #一致不可
                    break
    S,T=T,S
    #print("switch")
print(ans)

Submission status: Wrong Answer

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

ss,tt = 0,0

strset = "abcdefghijklmnopqrstuvwxyz"

dict = {}

for i in strset:
    ss += len(s.split(i))
    tt += len(t.split(i))
else:
    if ss != tt:
        print("No")
        exit()
    else:
        print("Yes")
        exit()

Submission status: Wrong Answer

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

ss,tt = 0,0

strset = "abcdefghijklmnopqrstuvwxyz"

dict = {}

for i in strset:
    ss += len(s.split(i))
    tt += len(t.split(i))
else:
    if ss != tt:
        print("No")
        exit()

for i in range(len(s)):
    # print(dict)
    if s[i] != t[i]:
        if t[i] not in dict:
            dict[t[i]] = s[i]
        elif dict[t[i]] != s[i]:
            print("No")
            exit()
        #elif dict[t[i]] != s[i]:
else:
    print("Yes")
"""
for i in strset:
    if i in dict: #p
        if dict[i] in dict: #z
            if i!=dict[dict[i]]:
                print("No")
                print(i,dict[dict[i]]) 
                break
else:
    print("Yes")
            #print(dict[i])
            #print(i)
            #print(dict[dict[i]])
#print("Yes")
"""

Submission status: Wrong Answer

Solution code:
S = list(input())
T = list(input())
s = []
t = []
ans_s = []
ans_t = []
for i in range(len(S)):
    s.append(S[i])
    t.append(T[i])
    ans_s.append(0)
    ans_t.append(0)
else:
    list(set(s))
    list(set(t))

if len(list(set(S))) == len(list(set(T))):
    print("No")
else:
    for i in range(len(s)):
        for j in range(len(S)):
            if S[j] == s[i]:
                ans_s[i] += 1
            if T[j] == t[i]:
                ans_t[i] += 1
    else:
        if ans_s == ans_t:
            print("Yes")
        else:
            print("No")

Submission status: Wrong Answer

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

strset = "abcdefghijklmnopqrstuvwxyz"

dict = {}

for i in range(len(s)):
    # print(dict)
    if s[i] != t[i]:
        if t[i] not in dict:
            dict[t[i]] = s[i]
        elif dict[t[i]] != s[i]:
            print("No")
            exit()
else:
    print("Yes")

Submission status: Wrong Answer

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


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

Submission status: Wrong Answer

Solution code:
s,t=input(),input()
rs=rt=[""for _ in range(26)]
def a(n):return [chr(ord('a')+i)for i in range(26)].index(n)
for i in range(len(s)):
  ss,tt=a(s[i]),a(t[i])
  if rs[ss]=="":rs[ss]=t[i]
  elif rs[ss]!=t[i]:print("No");exit()
  if rt[tt]=="":rt[tt]=s[i]
  elif rt[tt]!=s[i]:print("No");exit()
print("Yes")

Submission status: Wrong Answer

Solution code:
s,t=input(),input()
rs=rt=[""for _ in range(26)]
def a(n):return [chr(ord('a')+i)for i in range(26)].index(n)
for i in range(len(s)):
  if rs[a(s[i])]=="":rs[a(s[i])]=t[i]
  elif rs[a(s[i])]!=t[i]:print("No");exit()
  if rt[a(t[i])]=="":rt[a(t[i])]=s[i]
  elif rt[a(t[i])]!=s[i]:print("No");exit()
print("Yes")

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
S = input()
T = input()
 
if len(S) != len(T):
    print("No")
    exit()
 
D = {}
for s, t in zip(S, T):
    if s not in D:
        D[s] = t
    elif D[s] != t:
        print("No")
        exit()
 
print("Yes")

Submission status: Wrong Answer

Solution code:
# editorialを参考にした。なお、ord("a")=97,ord("b")=98...となっていることを使っている
S = input()
T = input()
StoT = [-1] * 26  # 変換は1対1対応をとっていないといけない
TfromS = [-1]*26
ans = 1

for i in range(len(S)):
    num_s = ord(S[i]) - 97
    num_t = ord(T[i])-97
    if StoT[num_s] == -1:
        StoT[num_s] == num_t
    else:
        if StoT[num_s] != num_t:
            ans = 0
            break

    if TfromS[num_t] == -1:
        TfromS[num_t] = num_s
    else:
        if TfromS[num_t] != num_s:
            ans = 0
            break

if ans == 1:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
S = input()
T = input()
diff = []
same = []
ans = 1
for i in range(len(S)):
    if S[i] == T[i]:
        if S[i] not in same:
            same.append(S[i])
    else:
        if S[i] not in diff:
            diff.append(S[i])
        if T[i] not in diff:
            diff.append(T[i])
for j in same:
    if j in diff:
        ans = 0
        break

if ans == 1:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
S = input()
T = input()
diff = []
same = []
ans = 1
for i in range(len(S)):
    if S[i] == T[i]:
        same.append(S[i])
    else:
        diff.append(S[i])
        diff.append(T[i])
for j in same:
    if j in diff:
        ans = 0
        break

if ans == 1:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
from collections import defaultdict

d1=defaultdict(lambda:'AA')
d2=defaultdict(lambda:'AA')
S=input()
T=input()
flag =True
for i in range(len(S)):
	if d1[S[i]]!='AA':
		if d1[S[i]] != T[i]:
			flag = False
			break
	d1[S[i]]=T[i]

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

Submission status: Wrong Answer

Solution code:
from collections import defaultdict

d1=defaultdict(lambda:'AA')
d2=defaultdict(lambda:'AA')
S=input()
T=input()
flag =True
for i in range(len(S)):
	if d1[T[i]]!='AA':
		if d1[T[i]] != S[i]:
			flag = False
			break
	d1[T[i]]=S[i]

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

Submission status: Wrong Answer

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

for _ in range(2):
    ans='Yes'
    table=[i+ord('a') for i in range(26)]
    for i in range(len(S)):
        if S[i]!=T[i]:
            if table[ord(S[i])-ord('a')]!=ord(S[i]) and table[ord(S[i])-ord('a')]!=ord(T[i]):
                ans='No'
                break
            else:
                table[ord(S[i])-ord('a')]=ord(T[i])
    S,T=T,S
print(ans)

Submission status: Wrong Answer

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

ans='Yes'
SS=[S[0]]
for i in range(len(S)-1):
    if S[i]!=S[i+1]:
        SS.append(S[i+1])
if len(SS)!=len(set(SS)):
    ans='No'

TT=[T[0]]
for i in range(len(T)-1):
    if T[i]!=T[i+1]:
        TT.append(T[i+1])
if len(TT)!=len(set(TT)):
    ans='No'

print(ans)

Submission status: Wrong Answer

Solution code:
# ABC110C - String Transformation
def main():
    s, t = [input().rstrip() for _ in range(2)]
    print("Yes" if len(set(s)) == len(set(t)) else "No")


if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
s=list(input())
t=list(input())
ls = [[] for _ in range(2)]
for i in range(len(s)):
    if s[i]==t[i]:
        pass
    else:
        if s[i] in ls[0]:
            index = ls[0].index(s[i])
            if t[i] == ls[1][index]:
                pass
            else:
                print("No")
                exit()
        else:
            if t[i] in ls[1]:
                print("No")
                exit()
            else:
                ls[0].append(s[i])
                ls[1].append(t[i])
print("Yes")

Submission status: Wrong Answer

Solution code:
s = input()
t = input()
l = [[] for _ in range(26)]
n = len(s)

for i in range(n):
    l[ord(t[i]) - 97].append(i)
for i in l:
    if len(i) > 1:
        if any([s[j] == t[j] for j in i]) and not all(s[j] == t[j] for j in i):
            print("No")
            exit()
        else:
            continue
print("Yes")

Submission status: Wrong Answer

Solution code:
import sys
S = input()
T = input()
abc = ["hoge"] * 26

for i in range(len(S)):
    now = S[i]
    if S[i] == T[i] and abc[ord(S[i]) - ord("a")] != "hoge":
        print("No")
        sys.exit(0)
    elif abc[ord(S[i]) - ord("a")] != "hoge":
        now = abc[ord(S[i]) - ord("a")]

    if now == T[i]:
        continue
    else:
        abc[ord(now) - ord("a")] = T[i]
        abc[ord(T[i]) - ord("a")] = now

print("Yes")

Submission status: Wrong Answer

Solution code:
import sys
S = input()
T = input()
abc = ["hoge"] * 26
ord("a")
chr(97)

for i in range(len(S)):
    if S[i] == T[i] or abc[ord(S[i]) - ord("a")] == T[i]:
        continue
    elif abc[ord(S[i]) - ord("a")] == "hoge" and abc[ord(T[i]) - ord("a")] == "hoge":
        abc[ord(S[i]) - ord("a")] = T[i]
        abc[ord(T[i]) - ord("a")] = S[i]
    else:
        print("No")
        sys.exit(0)
print("Yes")

Submission status: Wrong Answer

Solution code:
import sys
from collections import defaultdict
s = input()
t = input()
d1 = defaultdict(set)
d2 = defaultdict(set)

for i in range(len(s)):
    d1[t[i]].add(s[i])
    d2[s[i]].add(t[i])
    print(d1,d2)
    if len(d1[t[i]])>1 or len(d2[s[i]])>1:
        print("No")
        sys.exit()
print("Yes")

Submission status: Wrong Answer

Solution code:
from collections import defaultdict
s = input()
t = input()
d = defaultdict(set)
for i in range(len(s)):
  d[t[i]].add(s[i])
  if len(d[t[i]])>1:
    print("No")
    exit()
print("Yes")

Submission status: Wrong Answer

Solution code:
from collections import defaultdict

S = input()
T = input()

dict = defaultdict()

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

Submission status: Wrong Answer

Solution code:

S = list(input())
T = list(input())
henkan = {}
def check(a,b):
    cnt = 0
    if a in henkan.keys() :
        if henkan[a] != b :
            cnt += 1
    else :
        henkan[a] = b
    if b in henkan.keys() :
        if henkan[b] != a :
            cnt += 1
    else :
        henkan[b] = a
    return cnt

judge = True 
for i in range(len(S)):
    if  check(S[i],T[i]) > 0:
        judge = False 
    else : pass

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

Submission status: Wrong Answer

Solution code:
S = list(input())
T = list(input())
henkan = {}
def check(a,b):
    cnt = 0
    if a in henkan.keys() :
        if henkan[a] != b :
            cnt += 1
    if b in henkan.keys() :
        if henkan[b] != a :
            cnt += 1

    henkan[a] = b 
    henkan[b] = a
    return cnt

judge = True 
for i in range(len(S)):
    if  check(S[i],T[i]) > 0:
        judge = False 
    else : pass
print(henkan)
if judge : print("Yes")
else : print("No")

Submission status: Wrong Answer

Solution code:
S = input()
T = input()
#print(S, T)
if S == T:
    print('Yes')
    exit()
if len(S) != len(T):
    print('No')
    exit()

table1 = {}
table2 = {}
ret = True
for i in range(len(S)):
    s = S[i]
    t = T[i]
    if s == t:
        continue
    if t in table1:
        if table1[t] != s:
            ret = False
            break
    else:
        table1[t] = s
    if s in table2:
        if table2[s] != t:
            ret = False
            break
    else:
        table2[s] = t

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

Submission status: Wrong Answer

Solution code:
S = input()
T = input()
#print(S, T)
if S == T:
    print('Yes')
    exit()
if len(S) != len(T):
    print('No')
    exit()

table = {}
for i in range(len(S)):
    s = S[i]
    t = T[i]
    if s == t:
        continue
    if t in table:
        if table[t] != s:
            print('No')
            exit()
    else:
        table[t] = s

print('Yes')

Submission status: Wrong Answer

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

for s,t in zip(S,T):
    if s == t:
        continue
    else:
        for i in S:
            if i != s:
                continue
            else:
                if t != T[S.index(i)]:
                    print("No")
                    exit()
print("Yes")

Submission status: Wrong Answer

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

# ある方のアルファベット対応表
c_s = []
c_t = []
# ない方のアルファベット対応表
n_s = []
n_t = []

for i in range(len(s)):
    if s[i] in t:
        c_s.append(s[i])
    if t[i] in s:
        c_t.append(t[i])
    if s[i] not in t:
        n_s.append(s[i])
    if t[i] not in s:
        n_t.append(t[i])

if len(c_s) == len(c_t):
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

Solution code:
s = sorted(list(input()))
s = ''.join(s)

t = sorted(list(input()))
t = ''.join(t)

count = 0

while s != t:
    for i in range(len(s)):
        if s[i] == t[i]:
            continue
        else:
            c1 = s[i]
            c2 = t[i]
            s = s.replace(c1, c2)
        count += 1
    if count > 10:
        print('No')
        exit()

print('Yes')

Submission status: Wrong Answer

Solution code:
s = sorted(list(input()))
s = ''.join(s)

t = sorted(list(input()))
t = ''.join(t)

for i in range(len(s)):
    if s[i] == t[i]:
        continue
    else:
        c1 = s[i]
        c2 = t[i]
        s = s.replace(c1, c2)

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

Submission status: Wrong Answer

Solution code:
# INPUT
first_word = input()
second_word = input()

# # PROCESS
answer = "No"
answer_dict = {}
answer_dict2 = {}

def check_dict(dict, val_word, check_word):
  answer_bool = True
  for i in range(len(val_word)):
    if (val_word[i] in answer_dict.keys()):
      if (answer_dict[val_word[i]] != check_word[i]):
        answer_bool = False
        break
    else:
      answer_dict[val_word[i]] = check_word[i]

  return answer_bool

if (check_dict(answer_dict, first_word, second_word) and check_dict(answer_dict2, second_word, first_word)):
  answer = "Yes"

# OUTPUT
print(answer)

Submission status: Wrong Answer

Solution code:
S = input()
T = input()
TS = list(zip(T, S))

TS_set = set()
for t,s in TS:
  TS_set.add((t,s))
  TS_set.add((s,t))

S_set = set()
for x in TS_set:
  S_set.add(x[1])

print("Yes" if S == T or len(TS_set) == len(S_set) and len(S_set) < 26 else "No")

Submission status: Wrong Answer

Solution code:
S = input()
T = input()
TS = list(zip(T, S))

TS_set = set()
for x in TS:
  TS_set.add(x)

S_set = set()
for x in TS_set:
  S_set.add(x[1])

print("Yes" if S == T or len(TS_set) == len(S_set) and len(S_set) < 26 else "No")

Submission status: Wrong Answer

Solution code:
S = input()
T = input()
TS = list(zip(T, S))

TS_set = set()
for x in TS:
  TS_set.add(x)

S_set = set()
for x in TS_set:
  S_set.add(x[1])

print("Yes" if len(S_set) == 26 and S == T or len(TS_set) == len(S_set) else "No")

Submission status: Wrong Answer

Solution code:
S = input()
T = input()
TS = list(zip(T, S))

TS_set = set()
for x in TS:
  TS_set.add(x)

S_set = set()
for x in TS_set:
  S_set.add(x[1])

print("Yes" if len(TS_set) == len(S_set) else "No")

Submission status: Wrong Answer

Solution code:

S = input()
T = input()

S_dic={}
T_dic={}

for i in range(len(S)):

    if S[i] in S_dic:
        S_dic[S[i]].append(i)
    else:
        S_dic[S[i]] = [i]

for i in range(len(T)):

    if T[i] in T_dic:
        T_dic[T[i]].append(i)
    else:
        T_dic[T[i]] = [i]


print (S_dic)
print (T_dic)

T_dicR = {}

for i in T_dic:
    T_dicR[ str(T_dic[i]) ] = 1

ans = True

for i in S_dic:

    if str(S_dic[i]) not in T_dicR:
        ans = False
        break

print (T_dicR)

if ans:
    print ("Yes")

else:
    print ("No")

Submission status: Wrong Answer

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

    for i in range(len(S)-1):
        if S[i] != T[i]:
            c1 = S.find(S[i], i+1)
            if c1 != -1 and T[c1] != T[i]:
                print("No")
                return
            c2 = S.find(T[i], i+1)
            if c2 != -1 and S[i] != T[c2]:
                print("No")
                return
            print("{} <-> {}".format(S[i], T[i]))
    print("Yes")



if '__main__' == __name__:
    resolve()

Submission status: Wrong Answer

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

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

X = set()
Y = set()
for x, y in U:
  X.add(x)
  Y.add(y)

if len(X) == len(Y) == len(U):
  print("Yes")
else:
  print("No")

Submission status: Wrong Answer

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

U = set()
for s, t in sorted(zip(S, T)):
  if s > t:
    s, t = t, s
  U.add((s, t))

U = sorted(U)
for x, y in zip(U[0:-1], U[1:]):
  if x[0] == y[0]:
    print("No")
    break
else:
  print("Yes")

Submission status: Wrong Answer

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

U = set()
for s, t in sorted(zip(S, T)):
  U.add((s, t))

U = sorted(U)
print(U)
for x, y in zip(U[0:-1], U[1:]):
  if x[0] == y[0]:
    print("No")
    break
else:
  print("Yes")

Submission status: Wrong Answer

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

U = set()
for s, t in sorted(zip(S, T)):
  U.add((s, t))

U = sorted(U)
for x, y in zip(U[0:-1], U[1:]):
  if x[0] == y[0]:
    print("No")
    break
else:
  print("Yes")

Submission status: Wrong Answer

Solution code:
S = input()
T = input()
onaji_ari_flg = False
onaji_moji = []
for i, s in enumerate(S):
    if T[i] == s:
        onaji_ari_flg = True
        onaji_moji.append(s)

for o in onaji_moji:
    if T.count(o) != onaji_moji.count(o):
        print('No')
        exit(0)
print('Yes')

Submission status: Wrong Answer

Solution code:
s=set(input())
t=set(input())
print("No" if len(s^t)%2 else "Yes")

Submission status: Wrong Answer

Solution code:
s=set(input())
t=set(input())
print("No" if (len(s)-len(t))%2 else "Yes")

Submission status: Wrong Answer

Solution code:
s,t=input(),input()
d={"a":0,"b":0,"c":0,"d":0,"e":0,"f":0,"g":0,"h":0,"i":0,"j":0,"k":0,"l":0,"m":0,"n":0,"o":0,"p":0,"q":0,"r":0,"s":0,"t":0,"u":0,"v":0,"w":0,"x":0,"y":0,"z":0}
for h in range(len(s)):
  i,j=s[h],t[h]
  if d[i]==0:d[i]=j
  elif d[i]!=j:print("No");exit()
  if d[j]==0:d[j]=i
  elif d[j]!=i:print("No");exit()
print("Yes")

Submission status: Wrong Answer

Solution code:
# PROXY

from collections import Counter
S = list(input())
T = list(input())
if len(T) == len(set(T)) and len(S) == len(set(S)):
    print("Yes")
elif len(S) != len(set(S)) and len(T) != len(set(T)):
    Tdup = sorted([e for e in set(T) if T.count(e) > 1], key=T.index)
    Sdup = sorted([e for e in set(S) if S.count(e) > 1], key=S.index)
    counter = 0
    while counter < len(Tdup):
        Tdupid = [i for i, x in enumerate(T) if x == Tdup[counter]]
        Sdupid = [i for i, x in enumerate(S) if x == Sdup[counter]]
        if Tdupid != Sdupid:
            print("No")
            break
        else:
            counter += 1
    else:
        print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
# PROXY

from collections import Counter
S = list(input())
T = list(input())
if len(T) == len(set(T)) and len(S) == len(set(S)):
    print("Yes")
elif len(S) != len(set(S)):
    Tdup = sorted([e for e in set(T) if T.count(e) > 1], key=T.index)
    Sdup = sorted([e for e in set(S) if S.count(e) > 1], key=S.index)
    counter = 0
    while counter < len(Tdup):
        Tdupid = [i for i, x in enumerate(T) if x == Tdup[counter]]
        Sdupid = [i for i, x in enumerate(S) if x == Sdup[counter]]
        if Tdupid != Sdupid:
            print("No")
            break
        else:
            counter += 1
    else:
        print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
# PROXY

from collections import Counter
S = list(input())
T = list(input())
if len(T) == len(set(T)):
    print("Yes")
elif len(S) != len(set(S)):
    Tdup = sorted([e for e in set(T) if T.count(e) > 1], key=T.index)
    Sdup = sorted([e for e in set(S) if S.count(e) > 1], key=S.index)
    counter = 0
    while counter < len(Tdup):
        Tdupid = [i for i, x in enumerate(T) if x == Tdup[counter]]
        Sdupid = [i for i, x in enumerate(S) if x == Sdup[counter]]
        if Tdupid != Sdupid:
            print("No")
            break
        else:
            counter += 1
    else:
        print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
# PROXY

S = list(input())
T = list(input())
def has_duplicates(seq):
    return len(seq) != len(set(seq))
if has_duplicates(T):
    if has_duplicates(S):
        counter = 0
        while counter < len(sorted([e for e in set(T) if T.count(e) > 1], key=T.index)):
            if [i for i, x in enumerate(T) if x == sorted([e for e in set(T) if T.count(e) > 1], key=T.index)[counter]]\
                == [i for i, x in enumerate(S) if x == sorted([e for e in set(S) if S.count(e) > 1], key=S.index)[counter]]:
                counter += 1
            else:
                print("No")
                break
        else:print("Yes")
    else:
        print("No")
else:
    print("Yes")

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

import sys

input = sys.stdin.readline

def main():
    S = input()
    T = input()
    m = {}
    for i in range(len(T)):
        if T[i] in m:
            if m[T[i]] != S[i]:
                print("No")
                return
        m[T[i]] = S[i]
    print("Yes")

main()

Submission status: Wrong Answer

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

_d = {}
for i, t in enumerate(T):
  if S[i] == _d.setdefault(t, S[i]):
    continue
  else:
    print('No')
    break
else:
  print('Yes')

Submission status: Wrong Answer

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

convert = dict()

bl = True
for s,t in zip(S,T):
  if s in convert and convert[s] != t:
    bl = False
    break
  convert[s] = t

print('Yes' if bl else 'No')

Submission status: Wrong Answer

Solution code:
S = input()
T = input()
for i in range(0, len(S)-1):
  for j in range(i+1, len(S)):
    if (S[i]==S[j]) and (T[i]!=T[j]):
      print("No")
      break
  else:
    continue
  break
else:
  print("Yes")

Submission status: Wrong Answer

Solution code:
S = (str(input()))
T = (str(input()))
cnt = 0
for i in  range(len(S)):
    for j in range(i):
        if S[i] == S[j] and T[i] != T[j]:
            cnt += 1
        elif S[i] != S[j] and T[i] == T[j]:
            cnt += 1
if cnt > 1:
  print('No')
else:
  print('Yes')

Submission status: Wrong Answer

Solution code:
"""
思いつかない
最低でも、構成要素が同じでないと、入れ替えても無駄
"""

S = input()
T = input()

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

Submission status: Wrong Answer

Solution code:
from sys import stdin

S = stdin.readline().rstrip()
T = stdin.readline().rstrip()
alphabet = 'abcdefghijklmnopqrstuvwxyz'
cnt = 0

for letter in alphabet:
    X = []
    Y = []
    for k in range(len(T)):
        if T[k] == letter:
            X.append(S[k])
            if len(X) > 1 and X[len(X) - 1] != X[len(X) - 2]:
                print('No')
                break
        if S[k] == letter:
            Y.append(T[k])
            if len(Y) > 1 and Y[len(Y) - 1] != Y[len(Y) - 1]:
                print('No')
                break
    if len(X) > 1 and X[len(X) - 1] != X[len(X) - 2]:
        break
    if len(Y) > 1 and Y[len(Y) - 1] != Y[len(Y) - 2]:
        break
    cnt += 1

if cnt == 26:
    print('Yes')

Submission status: Wrong Answer

Solution code:
from sys import stdin

S = stdin.readline().rstrip()
T = stdin.readline().rstrip()
alphabet = 'abcdefghijklmnopqrstuvwxyz'
cnt = 0

for letter in alphabet:
    X = []
    Y = []
    for k in range(len(T)):
        if T[k] == letter:
            X.append(S[k])
            if len(X) > 1 and X[len(X) - 1] != X[len(X) - 2]:
                print('No')
                break
    for l in range(len(S)):
        if S[l] == letter:
            Y.append(T[l])
            if len(Y) > 1 and Y[len(Y) - 1] != Y[len(Y) - 2]:
                print('No')
                break
    if len(X) > 1 and X[len(X) - 1] != X[len(X) - 2]:
        break
    if len(Y) > 1 and Y[len(Y) - 1] != Y[len(Y) - 2]:
        break
    cnt += 1

if cnt == 26:
    print('Yes')

Submission status: Wrong Answer

Solution code:
from sys import stdin

S = stdin.readline().rstrip()
T = stdin.readline().rstrip()
alphabet = 'abcdefghijklmnopqrstuvwxyz'
cnt = 0

for letter in alphabet:
    X = []
    for k in range(len(T)):
        if T[k] == letter:
            X.append(S[k])
            if len(X) > 1 and X[len(X) - 1] != X[len(X) - 2]:
                print('No')
                break
    if len(X) > 1 and X[len(X) - 1] != X[len(X) - 2]:
        break
    cnt += 1

if cnt == 26:
    print('Yes')

Submission status: Wrong Answer

Solution code:
from collections import Counter

s = input()
t = input()

flag = True

s_count = dict(Counter(s))
t_count = dict(Counter(t))

for i, j in s_count.items():
  t_count[i] = t_count.get(i, 0)
  if t_count[i] != s_count[i] and t_count[i] != 0:
    flag = False
    
if flag:
  print('Yes')
else:
  print('No')

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

    stdic = {}
    for s,t in zip(S,T):
        if s not in stdic:
            stdic[s] = t
        else:
            if stdic[s] != t:
                print(NO)
                return

    checkv = []
    for k,v in stdic.items():
        if k == v:
            continue
        if v in stdic and stdic[v] == k:
            continue
        checkv.append(v)


    if len(checkv) == len(set(checkv)):
        print(YES)
    else:
        print(NO)

    return


# Generated by 1.1.4 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
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())

new_S = ""
new_T = ""


def change_word(a,b,S):
    for i in range(len(S)):
        if S[i] == a:
            S[i] = b
        elif S[i] == b:
            S[i] = a
        else:
            S[i] == S[i]
    return S



tmp_s = {}
tmp_t = {}
for i in range(len(S)):
    if S[i] in tmp_s:
        S[i] = tmp_s[S[i]]
    if T[i] in tmp_t:
        T[i] = tmp_t[T[i]]
    if S[i] != T[i]:
        if S[i] in tmp_s:
            if tmp_s[S[i]] != T[i]:
                print("No")
                exit()
        if T[i] in tmp_t:
            if tmp_t[T[i]] != S[i]:
                print("No")
                exit()

        tmp_s[S[i]] = T[i]
        tmp_t[T[i]] = S[i]

     
print("Yes")

Submission status: Wrong Answer

Solution code:
S, T = open(0).read().split()
m1, m2 = {}, {}
for s, t in zip(S, T):
    if s in m1:
        m1[s].add(t)
    else:
        m1[s] = set(t)
    if t in m2:
        m2[t].add(s)
    else:
        m2[t] = set(s)
for v in m1.values():
    if len(v) != 1:
        print('No')
        exit()
for k, v in m2.items():
    if k in v and len(v) != 1:
        print('No')
        exit()
print('Yes')

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
"""
Created on Fri May 17 00:23:37 2019

@author: avina
"""

s1 = input().strip()
s2 = input().strip()
F = True
d = {}
s = {}
for i in range(len(s1)):
  if s2[i] not in s:
     s[s2[i]] = s1[i]
  elif s[s2[i]] != s1[i]:
      F = False
      break
  if s1[i] not in d:
      d[s1[i]] = s2[i]
  elif d[s1[i]] != s2[i]:
       F = True
       break
if F:
   print('Yes')
else:
   print('No')