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:
flag1=False
for i in range(2):
    if i==0:
        a1=input()
    else:
        b1=input()
import collections
a=collections.Counter(a1)
b=collections.Counter(b1)
listsa=[]
for s in a.values():
    listsa.append(s)
listsb=[]
for s in b.values():
    listsb.append(s)
lista=sorted(listsa)
listb=sorted(listsb)
if listsa==listsb:
    flag1=True
    
flag2=True
n=len(a1)
for i in range(n-1):
    if a1[i]!=a1[i+1] and b1[i]==b1[i+1]:
        flag2=False
        break
    elif a1[i]==a1[i+1] and b1[i]!=b1[i+1]:
        flag2=False
        break
if flag1 and flag2:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
for i in range(2):
    if i==0:
        a=input()
    else:
        b=input()
import collections
a=collections.Counter(a)
b=collections.Counter(b)
listsa=[]
for s in a.values():
    listsa.append(s)
listsb=[]
for s in b.values():
    listsb.append(s)
lista=sorted(listsa)
listb=sorted(listsb)
if listsa==listsb:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

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

ds={};dt={}
for i in range(len(S)):
    c=S[i];d=T[i]
    if c not in ds:
        ds[c]={i}
    else:
        ds[c].add(i)
    if d not in dt:
        dt[d]={i}
    else:
        dt[d].add(i)

ss=list(ds.values())
st=list(dt.values())
ss.sort();st.sort()

print('Yes' if ss==st else 'No')

Submission status: Wrong Answer

Solution code:
import collections

S=input()
T=input()

ds={};dt={}
for i in range(len(S)):
    c=S[i];d=T[i]
    if c not in ds:
        ds[c]={i,}
    else:
        ds[c].add(i)
    if d not in dt:
        dt[d]={i}
    else:
        dt[d].add(i)

ss=list(ds.values())
st=list(dt.values())

print('Yes' if ss==st else 'No')

Submission status: Wrong Answer

Solution code:
s=input()
t=input()
n=len(s)
word="abcdefghijklmnopqrstuvwxyz"
data_s=[[] for i in range(26)]
data_t=[[] for i in range(26)]
for i in range(26):
    a=word[i]
    for j in range(n):
        if s[j]==a:
            data_s[i].append(j)
        if t[j]==a:
            data_t[i].append(j)
data_s.sort()
data_t.sort()
if data_s==data_t:
    print("yes")
else:
    print("no")

Submission status: Wrong Answer

Solution code:
from collections import defaultdict
s = input()
t = input()
dic = defaultdict(int)
trans = defaultdict(int)
for i in range(len(t)):
  c = t[i]
  m = s[i]
  if trans[c]==0:
    trans[c] = m
  elif trans[c] != m:
    print('No')
    break
else:
  print('Yes')

Submission status: Wrong Answer

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

t_set = [tt for tt in set(t) if t.count(tt)>1]
for tt in list(t_set):
  index_num = [n for n, v in enumerate(s) if v == tt]
  
  s_id = []
  for index in index_num:
    if t[index] != s[index]:
      s_id.append(s[index])
  
  if len(set(s_id)) == 1:
    continue
  else:
    print("No")
    break
else:
  print("Yes")

Submission status: Wrong Answer

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

t_set = [tt for tt in set(t) if t.count(tt)>1]
for tt in list(t_set):
  index_num = [n for n, v in enumerate(s) if v == tt]
  
  s_id = []
  for index in index_num:
    s_id.append(s[index])
  
  if len(set(s_id)) == 1:
    continue
  else:
    print("No")
    break
else:
  print("Yes")

Submission status: Wrong Answer

Solution code:
def count(s):
    L = len(s)
    s0 = s[0]
    ans = ""
    cnt = 1
    for i in range(1, L):
        if s0 == s[i]:
            cnt += 1
        else:
            ans = ans + str(cnt)
            cnt = 1
    if cnt >= 2:
        ans = ans + str(cnt)

    return ans


S = input()
T = input()

Sx = count(S)
Tx = count(T)

if Sx == Tx:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
S = input()
T = input()
len1 = len(S)
data = {}
ans = 'Yes'
for i in range(len1):
    s = S[i]
    t = T[i]
    if s != t:
        if s in data:
            if data[s] == t:
                pass
            else:
                ans = 'No'
                break
        else:
            data[s] = t

print(ans)

Submission status: Wrong Answer

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

N = len(S)
Slist = {}
Tlist = {}
for i in range(N):
    if S[i] in Slist:
        Slist[S[i]] += 1
    else:
        Slist[S[i]] = 1
    if T[i] in Tlist:
        Tlist[T[i]] += 1
    else:
        Tlist[T[i]] = 1

M = len(Slist)
L = len(Tlist)
if M == L:
    skey = []
    tkey = []
    svalue = []
    tvalue = []
    for k, v in Slist.items():
        skey.append(k)
        svalue.append(v)
    skey.sort()
    svalue.sort()
    print(skey)
    print(svalue)
    for k, v in Tlist.items():
        tkey.append(k)
        tvalue.append(v)
    tkey.sort()
    tvalue.sort()
    print(tkey)
    print(tvalue)
    if svalue == tvalue:
        print('Yes')
    else:
        print('No')
        
else:
    print('No')

Submission status: Wrong Answer

Solution code:
s, t = input(), input()
ans = "Yes"
dct = {i:set() for i in t}
for i in range(len(s)): dct[t[i]].add(s[i])
for i in dct.items():
    if len(i[1])>1:ans="No"
print(ans)

Submission status: Wrong Answer

Solution code:
import collections, re, itertools

S = input()
T = input()

# 文字リストとcollections.Counterを渡すと、同じ文字が存在するインデックスの集合を返す関数
def same_letter_index_set(A, cA):
    output = []
    for s in cA.keys():
        match_index_list = [m.span() for m in re.finditer(s, A)]
        output.append(list(itertools.chain.from_iterable([m.span() for m in re.finditer(s, A)])))
    return output

# それぞれの文字列において、同じ文字が存在するインデックスの集合を考える。それらが完全一致すれば置き換え可能
cS = collections.Counter(S)
cT = collections.Counter(T)
print("Yes" if same_letter_index_set(S, cS) == same_letter_index_set(T, cT) else "No")

Submission status: Wrong Answer

Solution code:
s=input()
t=input()
words={}
for i in range(len(s)):
    if t[i] not in words:words[t[i]]=[s[i]]
    else:words[t[i]] +=[s[i]]

for v in words.values():
    if len(set(v))>1:print("No");exit()
print("Yes")

Submission status: Wrong Answer

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

str = "abcdefghijklmnopqrstuvwxyz"
S_cnt = {s: [] for s in str}
T_cnt = {s: [] for s in str}
for i in range(len(S)):
    S_cnt[S[i]].append(i)
    T_cnt[T[i]].append(i)
    if (len(S_cnt[S[i]])) > 1 or (len(T_cnt[T[i]])) > 1:
        if len(S_cnt[S[i]]) == len(T_cnt[T[i]]):
            if S_cnt[S[i]] != T_cnt[T[i]]:
                print("No")
                break
        else:
            if len(S_cnt[S[i]]) > len(T_cnt[T[i]]):
                T_len = len(T_cnt[T[i]])
                temp = T_cnt[T[i-T_len]] + T_cnt[T[i]]
                # print(temp)
                if temp != S_cnt[S[i]]:
                    print("No")
                    break
            else:
                S_len = len(S_cnt[S[i]])
                temp = S_cnt[S[i-S_len]] + S_cnt[S[i]]
                # print(temp)
                if temp != T_cnt[T[i]]:
                    print("No")
                    break
else:
    print("Yes")

# print(S_cnt["r"] != T_cnt["r"])
# print(S_cnt, "\n", T_cnt)

Submission status: Wrong Answer

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

str = "abcdefghijklmnopqrstuvwxyz"
S_cnt = {s: [] for s in str}
T_cnt = {s: [] for s in str}
for i in range(len(S)):
    S_cnt[S[i]].append(i)
    T_cnt[T[i]].append(i)
    if (len(S_cnt[S[i]])) > 1 or (len(T_cnt[S[i]])) > 1:
        if S_cnt[S[i]] != T_cnt[T[i]]:
            print("No")
            break
else:
    print("Yes")

# print(S_cnt["r"] != T_cnt["r"])
# print(S_cnt, "\n", T_cnt)

Submission status: Wrong Answer

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

dic={}
ans='Yes'
for i in range(n):
    if t[i] not in dic:
        dic[t[i]]=s[i]
    
    if s[i]==t[i]:
        if dic[t[i]]==t[i]:
            continue
        else:
            ans='No'
            break

    else:
        if dic[t[i]]==s[i]:
            continue
        else :
            ans='No'
            break

print(ans)

Submission status: Wrong Answer

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

dic={}
ans='Yes'
for i in range(n):
    if s[i]==t[i] and s[i] in dic:
        ans='No'
        break
    
    if t[i] not in dic:
        dic[t[i]]=s[i]
    else:
        if dic[t[i]]==s[i]:
            continue
        else:
            ans='No'
            break

print(ans)

Submission status: Wrong Answer

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

# print(S,T)

sh = {}
for s in S:
    sh[s] = 1

th = {}
for t in T:
    th[t] = 1

sdiff = 0
for s in sh.keys():
    if th.get(s) == None:
        sdiff += 1

tdiff = 0
for t in th.keys():
    if sh.get(t) == None:
        tdiff += 1

# 2x10^5x4

if sdiff == tdiff:
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

Solution code:
from collections import Counter

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

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

# print(s_counter)
# print(t_counter)

dict_S_to_T = {}
dict_T_to_S = {}

for s, t in zip(S, T):
    if s != t:
        dict_S_to_T[s] = t
        dict_T_to_S[t] = s


flag = True
for k, v in dict_S_to_T.items():
    if dict_T_to_S[v] != k and (s_counter[k]+s_counter[v] != t_counter[k]+t_counter[v]):
        flag = False

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

Submission status: Wrong Answer

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

dict_S_to_T = {}
dict_T_to_S = {}

for s, t in zip(S, T):
    if s != t:
        dict_S_to_T[s] = t
        dict_T_to_S[t] = s


flag = True
for k, v in dict_S_to_T.items():
    if dict_T_to_S[v] != k:
        flag = False

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

Submission status: Wrong Answer

Solution code:
import collections
S=input()
T=input()
tableS=collections.defaultdict(list)
tableT=collections.defaultdict(list)

for i in range(len(S)):
  tableS[S[i]].append(i)
  tableT[T[i]].append(i)
listS=tableS.values()
listT=tableT.values()
for x in listS:
  flag=False
  for y in listT:
    if x in y:
      flag=True
      break
  if not flag:
    print("No")
    exit(0)
print("Yes")

Submission status: Wrong Answer

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

# ccとaa OK
# cbとaa NO
for i in range(len(s)):
    if t.count(s[i])<=1:
        continue
    else:
        match_ch=[]
        for j in range(len(t)):
            if t[j]==s[i]:
                #print("t：{},s:{}".format(t[j],s[i]))
                if len(match_ch)==0:
                    match_ch.append(s[j])
                    #print("match_ch{}".format(match_ch))
                elif s[j] not in match_ch:
                    print("No")
                    exit()
print("Yes")

Submission status: Wrong Answer

Solution code:
s = input()
t = input()
ar_s = [len(a) for a in set(s)].sort()
ar_t = [len(a) for a in set(t)].sort()
if (ar_s == ar_t):
    print ('Yes')
else:
    print ('No')

Submission status: Wrong Answer

Solution code:
s = input()
t = input()
ret = 'Yes'
for a in set(s):
    cs = s.count(a)
    ts = t.count(a)
    if (cs > 1 and ts > 0 and cs != ts) or (cs > 0 and ts > 1 and cs != ts):
        ret = 'No'
        break
print (ret)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
s = input()
t = input()
ret = 'Yes'
for a in s:
    cs = s.count(a)
    ts = t.count(a)
    if cs > 0 and ts > 0 and cs != ts:
        ret = 'No'
        break
print (ret)

Submission status: Wrong Answer

Solution code:
S = raw_input()
T = raw_input()
d = dict()
d2 = dict()
ret = True
for s, t in zip(S, T):
    if s in d and d[s] != t:
        ret = False
        break
    if t in d2 and d2[t] != 2:
        ret = False
        break
    d[s] = t
    d2[t] = s
        
print 'Yes' if ret else 'No'

Submission status: Wrong Answer

Solution code:
S = raw_input()
T = raw_input()
d = dict()
ret = True
for s, t in zip(S, T):
    if s in d and d[s] != t:
        ret = False
        break
    d[s] = t
print 'Yes' if ret else 'No'

Submission status: Wrong Answer

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

bool =True
for a,b in zip(s,t):
    if a in dct and dct[a]!=b:
        bool =False
        break
    dct[a]=b
#print(dct)
#print(len(dct.values()))
#print(len(dct))
if len(dct.values())!=len(set(dct)):
    bool =False
print('Yes' if bool else 'No')

Submission status: Wrong Answer

Solution code:
S = input()
T = input()
SET= set(T)
DICT=dict.fromkeys(SET,'')
c=0
for i in range(len(S)):
    DICT[str(T[i])]+=S[i]
for j in DICT.values():
    if len(set(j)) >= 2:
        c+=1
        break
if c == 0 :
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

Solution code:
S = input()
T = input()
N = len(S)
array = []
array2 = []
array3 = []
for i in range(N):
    array.append(S[i])
    array.append(T[i])
    array2.append(S[i])
    array3.append(T[i])
A = len(set(array))
B = len(set(array2))
C = len(set(array3))
if (A == B + 1 and A == C + 1) or (A == B and A == C):
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

Solution code:
S = input()
T = input()
N = len(S)
array = []
array2 = []
for i in range(N):
    array.append(S[i])
    array.append(T[i])
    array2.append(S[i])
array = set(array)
M = len(set(array2))
if len(array) == M or len(array) == M + 1:
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

Solution code:
S = input()
T = input()
N = len(S)
array = []
for i in range(N):
    array.append(S[i])
    array.append(T[i])
array = set(array)
if len(array) == N or len(array) == N + 1:
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

Solution code:
# C - String Transformation
import collections
S = str(input())
T = str(input())

S1 = sorted(collections.Counter(S).values())
T1 = sorted(collections.Counter(T).values())
print(S1,T1)

if S1 == T1:
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

Solution code:
# C - String Transformation
import collections
S = str(input())
T = str(input())

s1 = len(S)
t1 = len(T)

s2 = len(set(S))
t2 = len(set(T))

s3 = collections.Counter(S)
t3 = collections.Counter(T)

s4 = list(s3.values())
t4 = list(t3.values())

s5 = sum(i >= 2 for i in s4)
t5 = sum(j >= 2 for j in t4)

if s2 - s1 == t2 - t1 and s5 == t5:
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

Solution code:
# C - String Transformation
S = str(input())
T = str(input())

s1 = len(S)
t1 = len(T)

s2 = len(set(S))
t2 = len(set(T))

if s2 - s1 == t2 -t1:
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

Solution code:
S = list(input())
T = list(input())
table = [-1] * 26
a = ord("a")
for i in range(len(S)):
  if S[i] != T[i]:
    ind = ord(S[i]) - a
    if table[ind] == -1:
      table[ind] = ord(T[i]) - a
    elif table[ind] != ord(T[i]) - a:
      print("No")
      exit(0)
  else:
    ind = ord(S[i]) - a
    if table[ind] != -1:
      print("No")
      exit(0)
for i in range(26):
  for j in range(26):
    if table[i] != -1:
      if table[j] != -1:
        if table[i] == table[j] and i != j:
          print("No")
          exit(0)
for i in range(len(S)):
  ind = ord(S[i]) - a
  if table[ind] == -1: table[ind] = ind
  S[i] = chr(table[ind] + a)
if S == T:
  print("Yes")
else: print("No")

Submission status: Wrong Answer

Solution code:
from collections import Counter as cnt
fnc = lambda: cnt(cnt(input()).values())
print("Yes" if fnc == fnc else "No")

Submission status: Wrong Answer

Solution code:
S = list(input())
T = list(input())
table = [i for i in range(26)]
a = ord("a")
for i in range(len(S)):
  if S[i] != T[i]:
    inds = ord(S[i]) - a
    indt = ord(T[i]) - a
    table[inds] = indt
    table[indt] = inds
res = []
for i in range(len(S)):
  ind = ord(S[i]) - a
  c = chr(table[ind] + a)
  res.append(c)
if res == T:
  print("Yes")
else: print("No")

Submission status: Wrong Answer

Solution code:
S = list(input())
T = list(input())
table = [-1] * 26
a = ord("a")
for i in range(len(S)):
  if S[i] != T[i]:
    ind = ord(S[i]) - a
    if table[ind] == -1:
      table[ind] = ord(T[i]) - a
      table[ord(T[i]) - a] = ind
    elif table[ind] != ord(T[i]) - a:
      print("No")
      exit(0)
  else:
    ind = ord(S[i]) - a
    if table[ind] != -1:
      print("No")
      exit(0)
for i in range(26):
  for j in range(26):
    if table[i] != -1:
      if table[j] != -1:
        if table[i] == table[j] and i != j:
          print("No")
          exit(0)
print("Yes")

Submission status: Wrong Answer

Solution code:
S = list(input())
T = list(input())
table = [-1] * 26
a = ord("a")
for i in range(len(S)):
  if S[i] != T[i]:
    ind = ord(S[i]) - a
    if table[ind] == -1:
      table[ind] = ord(T[i]) - a
    elif table[ind] != ord(T[i]) - a:
      print("No")
      exit(0)
  else:
    ind = ord(S[i]) - a
    if table[ind] != -1:
      print("No")
      exit(0)
for i in range(26):
  for j in range(26):
    if table[i] != -1:
      if table[j] != -1:
        if table[i] == table[j] and i != j:
          print("No")
          exit(0)
print("Yes")

Submission status: Wrong Answer

Solution code:
S = list(input())
T = list(input())
table = [-1] * 26
a = ord("a")
for i in range(len(S)):
  if S[i] != T[i]:
    ind = ord(S[i]) - a
    if table[ind] == -1:
      table[ind] = ord(T[i]) - a
    elif table[ind] != ord(T[i]) - a:
      print("No")
      exit(0)
for i in range(26):
  for j in range(26):
    if table[i] != -1:
      if table[j] != -1:
        if table[i] == table[j] and i != j:
          print("No")
          exit(0)
print("Yes")

Submission status: Wrong Answer

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

cnt = 0

if len(s) != len(t):
    print('No')
    exit()

for i in range(len(s)):
    if s[i] != t[i]:
        cnt += 1

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

Submission status: Wrong Answer

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

cnt = 0

if len(s) != len(t):
    print('No')
    exit()

for i in range(len(s)):
    if s[i] != t[i]:
        cnt += 1

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

Submission status: Wrong Answer

Solution code:
from  collections import Counter

S = input()
T = input()

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

if sorted(s_counter.values()) == sorted(s_counter.values()):
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

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

d = dict()
ans = True
for s, t in zip(S, T):
    if t not in d:
        d[t] = s
    else:
        if d[t] != s:
            ans = False
            break

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

Submission status: Wrong Answer

Solution code:
from collections import defaultdict
S = list(input())
T = list(input())
l = len(S)
ds = defaultdict(str)
dt = defaultdict(str)
for i in range(l):
    if ds[S[i]] == "":
        ds[S[i]] = T[i]
    elif ds[S[i]] == T[i]:
        pass
    else:
        exit()
    if dt[T[i]] == "":
        dt[T[i]] = S[i]
    elif dt[T[i]] == S[i]:
        pass
    else:
        print('No')
        exit()

print('Yes')

Submission status: Wrong Answer

Solution code:
from collections import defaultdict
S = list(input())
T = list(input())
l = len(S)
ds = defaultdict(str)
dt = defaultdict(str)
for i in range(l):
    if ds[S[i]] == "":
        ds[S[i]] = T[i]
    elif ds[S[i]] == T[i]:
        pass
    else:
        exit()
    if dt[T[i]] == "":
        dt[T[i]] = S[i]
    elif dt[T[i]] == S[i]:
        pass
    else:
        exit()

print('Yes')

Submission status: Wrong Answer

Solution code:
from collections import defaultdict
S = list(input())
T = list(input())
l = len(S)
d = defaultdict(str)
for i in range(l):
    if d[S[i]] == "":
        d[S[i]] = T[i]
    elif d[S[i]] == T[i]:
        pass
    else:
        print('No')
        exit()

print('Yes')

Submission status: Wrong Answer

Solution code:
from collections import defaultdict
S = list(input())
T = list(input())
l = len(S)
d = defaultdict(str)
for i in range(l):
    if S[i] != T[i]:
        if d[S[i]] == "":
            d[S[i]] = T[i]
        elif d[S[i]] == T[i]:
            pass
        else:
          	print('No')
          	exit()
print('Yes')

Submission status: Wrong Answer

Solution code:
from collections import Counter
s = input()
t = input()
convert_dict = {}
count_list = []
count = {}

for i in range(len(s)):
    if s[i] not in convert_dict.keys():
        convert_dict[s[i]] = t[i]

    else:
        if convert_dict[s[i]] != t[i]:
            print("No")

for i in convert_dict.values():
    count_list.append(i)

count = Counter(count_list)

if max(count.values()) != 1:
    print("No")

else:
    print("Yes")

Submission status: Wrong Answer

Solution code:
s = input()
t = input()
count_s, count_t = 1, 1
s_list, t_list = [], []
kind_list_s , kind_list_t = [], []

for i in range(len(s) - 2):
    if s[i] == s[i + 1]:
        count_s += 1

    else:
        s_list.append(i)
        count_s = 1

    if s[i] not in kind_list_s:
        kind_list_s.append(s[i])

    if t[i] == t[i + 1]:
        count_t += 1

    else:
        t_list.append(i)
        count_t = 1

    if t[i] not in kind_list_t:
        kind_list_t.append(t[i])

if s_list == t_list and len(kind_list_s) == len(kind_list_t):
    print("Yes")

else:
    print("No")

Submission status: Wrong Answer

Solution code:
from collections import defaultdict
if __name__ == '__main__':
    S = str(input())
    T = str(input())
    
    count = defaultdict(str)
    
    flag = True
    for i in range(len(S)):
        s = S[i]
        t = T[i]
        if count[t] != '':
            if count[t] != s:
                flag = False
        else:
            count[t] = s
    if flag:
        print('Yes')
    else:
        print('No')

Submission status: Wrong Answer

Solution code:
S = list(input())
T = list(input())
dics ={}
dic ={}
for i in range(len(S)):
  if S[i] in dics:
  	dics[S[i]].append(i)
  else :
    dics[S[i]]=[i]
  if T[i] in dic:
    dic[T[i]].append(i)
  else:
    dic[T[i]]=[i]

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

Submission status: Wrong Answer

Solution code:
from sys import exit
S = input()
T = input()
d = {}
for i in range(26):
  c = chr(i + ord('a'))
  d[c] = '\0'
for i in range(len(S)):
  if d[S[i]] != '\0' or d[T[i]] != '\0':
    if d[S[i]] != T[i] or d[T[i]] != S[i]:
      print('No')
      exit()
  d[S[i]] = T[i]
  d[T[i]] = S[i]
print('Yes')

Submission status: Wrong Answer

Solution code:
from sys import exit
S = input()
T = input()
d = {}
for i in range(26):
  c = chr(i + ord('a'))
  d[c] = '\0'
for i in range(len(S)):
  if S[i] != '\0' or T[i] != '\0':
    if d[S[i]] != T[i] or d[T[i]] != S[i]:
      print('No')
      exit()
  d[S[i]] = T[i]
  d[T[i]] = S[i]
print('Yes')

Submission status: Wrong Answer

Solution code:
from sys import exit
S = input()
T = input()
d = {}
for i in range(len(S)):
  if S[i] in d or T[i] in d:
    print('No')
    exit()
  d[S[i]] = T[i]
  d[T[i]] = S[i]
print('Yes')

Submission status: Wrong Answer

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

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

if ''.join(d[c] for c in S) == T:
  print('Yes')
else:
  print('No')

Submission status: Wrong Answer

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

    f = True
    dep = {}

    for sc,tc in zip(s,t):
        if dep.get(tc) is not None or (dep.get(tc) != sc and sc in dep.values()):
            print("No")
            f = False
            break
        else:
            dep[tc] = sc

    if f:
        print("Yes")

if __name__ == "__main__":
    string_transformation()

Submission status: Wrong Answer

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

    f = True
    dep = {}

    for sc,tc in zip(s,t):
        if dep.get(tc) is not None and dep.get(tc) != sc:
            print("No")
            f = False
            break
        else:
            dep[tc] = sc

    if f:
        print("Yes")

if __name__ == "__main__":
    string_transformation()

Submission status: Wrong Answer

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

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

t = []
for i in range(len(S)):
  t.append(d[S[i]])

if ''.join(t) == T:
  print('Yes')
else:
  print('No')

Submission status: Wrong Answer

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

dic={}

ans=True
for i in range(len(s)):
    if s[i]==t[i]:
        continue
    else:
        if s[i] not in dic:
            dic[s[i]]=t[i]
        else:
            if dic[s[i]]!=t[i]:
                ans=False
                break

se=set()
for key,value in dic.items():
    se.add(value)
if len(se)!=len(dic):
    ans=False
    
print('Yes' if ans else 'No')

Submission status: Wrong Answer

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

dic={}

ans=True
for i in range(len(s)):
    if s[i]==t[i]:
        continue
    else:
        if s[i] not in dic:
            dic[s[i]]=t[i]
        else:
            if dic[s[i]]!=t[i]:
                ans=False
                break
print(ans)
se=set()
for key,value in dic.items():
    se.add(value)
if len(se)!=len(dic):
    ans=False
    
print('Yes' if ans else 'No')

Submission status: Wrong Answer

Solution code:
s = str(input())
t = str(input())
x = [0] * 26

alpha2num = lambda c: ord(c) - ord('A') -32
#aが0,zが25

for i in range(len(s)):
    if x[alpha2num(s[i])] == 0:
      x[alpha2num(s[i])] = t[i]
    else:
      if x[alpha2num(s[i])] != t[i]:
        print("No")
        quit()
    if x[alpha2num(t[i])] == 0:
      x[alpha2num(t[i])] = s[i]
    else:
      if x[alpha2num(t[i])] != s[i]:
        print("No")
        quit()
  #print(x)       
 

print("Yes")

Submission status: Wrong Answer

Solution code:
s = str(input())
t = str(input())
x = [0] * 26

alpha2num = lambda c: ord(c) - ord('A') -32
#aが0,zが25

for i in range(len(s)):
  if s[i] != t[i]:
    if x[alpha2num(s[i])] == 0:
      x[alpha2num(s[i])] = t[i]
    else:
      if x[alpha2num(s[i])] != t[i]:
        print("No")
        quit()
    if x[alpha2num(t[i])] == 0:
      x[alpha2num(t[i])] = s[i]
    else:
      if x[alpha2num(t[i])] != s[i]:
        print("No")
        quit()
  #print(x)       
 

print("Yes")

Submission status: Wrong Answer

Solution code:
S = input()
T = input()
Stype = []
Ttype = []

for i in range(len(S) - 1):
    count = 1
    if S[i] == S[i+1]:
        count += 1
    else:
        Stype.append(count)
for i in range(len(T) - 1):
    count = 1
    if T[i] == T[i+1]:
        count += 1
    else:
        Ttype.append(count)
if Stype == Ttype:
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

Solution code:
s = input()
t = input()
a = {}
for i, j in zip(s, t):
    if i in a:
        if a[i] != j:
            print("No")
            exit()
    elif j in a:
        if a[j] != i:
            print("No")
            exit()
    a[i] = j
    a[j] = i
print("Yes")

Submission status: Wrong Answer

Solution code:
s = input()
t = input()
a = {}
for i, j in zip(s, t):
    if i in a:
        if a[i] != j:
            print("No")
            exit()
    else:
        a[i] = j
        a[j]=i
print("Yes")

Submission status: Wrong Answer

Solution code:
s = input()
t = input()
a = {}
for i, j in zip(s, t):
    if i in a:
        if a[i] != j:
            print("No")
            exit()
    else:
        a[i] = j
print("Yes")

Submission status: Wrong Answer

Solution code:
S = list(map(str, input()))
T = list(map(str, input()))

dic, dic_2 = dict(), dict()

def dictionary_append(dictionary, lst):
	id = 0
	for s in lst:
		if not s in dictionary:
			dictionary[s] = []	
		dictionary[s].append(id)
		id += 1

dictionary_append(dic, S)
dictionary_append(dic_2, T)
	
s_prime	= list(dic.values())
t_prime = list(dic_2.values())
s_prime.sort()
t_prime.sort()

print(s_prime, t_prime)

no_flg = 0
for s, t in zip(s_prime, t_prime):
	if not s == t:
		print("No")
		no_flg = 1
		break
if not no_flg:
	print("Yes")

Submission status: Wrong Answer

Solution code:
S = list(map(str, input()))
T = list(map(str, input()))

dic, dic_2 = dict(), dict()

def dictionary_append(dictionary, lst):
	id = 0
	for s in lst:
		if not s in dictionary:
			dictionary[s] = []	
		dictionary[s].append(id)
		id += 1

dictionary_append(dic, S)
dictionary_append(dic_2, T)
	
s_prime	= dic.values()
t_prime = dic_2.values()

no_flg = 0
for s, t in zip(s_prime, t_prime):
	if not s == t:
		print("No")
		no_flg = 1
		break
if not no_flg:
	print("Yes")

Submission status: Wrong Answer

Solution code:
import string
import sys
S = input()
T = input()
sLst = [0] * 26
tLst = [0] * 26

for i in range(26):
    sLst[i] = S.count(string.ascii_lowercase[i])
    tLst[i] = T.count(string.ascii_lowercase[i])
sLst.sort(reverse=True)
tLst.sort(reverse=True)

for i in range(26):
    if sLst[i] != tLst[i]:
        print('No')
        sys.exit()

print('YES')

Submission status: Wrong Answer

Solution code:
from sys import exit
s = input()
t = input()
d = {}
for i in range(len(s)):
  if t[i] not in d:
    d[t[i]] = s[i]
  else:
    if d[t[i]] != s[i]:
      print('No')
      exit()
  if s[i] not 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:
from sys import exit
s = input()
t = input()
d = {}
for i in range(len(s)):
  if t[i] not in d:
    d[t[i]] = s[i]
  else:
    if d[t[i]] != s[i]:
      print('No')
      exit()
print('Yes')

Submission status: Wrong Answer

Solution code:
S = input()
T = input()
U = {}
for s, t in zip(S, T):
    if s == t:
        continue
    else:
        if U.get(s):
            if U[s] != t:
                print('No')
                exit()
        if U.get(t):
            if U[t] != s:
                print('No')
                exit()
        else:
            U[s] = t
            U[t] = s
print('Yes')

Submission status: Wrong Answer

Solution code:
S = input()
T = input()
U = {}
for s, t in zip(S, T):
    if s == t:
        continue
    else:
        if U.get(s):
            if U[s] != t:
                print('No')
                exit()
        else:
            U[s] = t
print('Yes')

Submission status: Wrong Answer

Solution code:
import sys
sys.setrecursionlimit(10**6)

S = list(input())
T = list(input())
ret = 'Yes'
t = {}
for i in range(len(S)):
    if S[i] in t:
        if t[S[i]] == T[i]:
            continue
        else:
            ret = 'No'
    if ret == 'No':
        break
    t[S[i]] = T[i]

print(ret)

Submission status: Wrong Answer

Solution code:
import sys
s = input()
t = input()
yetlist = {}
for i in range(len(s)):
    if s[i] in yetlist:
        if t[i] != yetlist[s[i]]:
            print("No")
            sys.exit()
    else:
        yetlist[s[i]] = t[i]
            
print("Yes")