Problem:


Score : 300 points

Problem Statement

You are given strings S and T consisting of lowercase English letters.

You can perform the following operation on S any number of times:

Operation: Choose two distinct lowercase English letters c_1 and c_2, then replace every occurrence of c_1 with c_2, and every occurrence of c_2 with c_1.

Determine if S and T can be made equal by performing the operation zero or more times.

Constraints

1 \leq |S| \leq 2 \times 10^5

|S| = |T|

S and T consists of lowercase English letters.

Input

Input is given from Standard Input in the following format:

S
T

Output

If S and T can be made equal, print Yes; otherwise, print No.

Sample Input 1

azzel
apple

Sample Output 1

Yes

azzel can be changed to apple, as follows:

Choose e as c_1 and l as c_2. azzel becomes azzle.

Choose z as c_1 and p as c_2. azzle becomes apple.

Sample Input 2

chokudai
redcoder

Sample Output 2

No

No sequences of operation can change chokudai to redcoder.

Sample Input 3

abcdefghijklmnopqrstuvwxyz
ibyhqfrekavclxjstdwgpzmonu

Sample Output 3

Yes



Sample input:
azzel
apple


Sample output:
Yes

Submission status: Wrong Answer

Solution code:
from collections import Counter

s=input()
t=input()

c1=Counter(s)
c2=Counter(t)

k1=sorted(c1.keys())
k2=sorted(c2.keys())

if len(k1)==len(k2):
  for i in range(len(k1)):
    if c1[i]!=c2[i]:
      print('No')
      exit()
  print('Yes')
else:
  print('No')

Submission status: Wrong Answer

Solution code:
# coding: utf-8
import sys
from collections import Counter

sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))

S = sr()
T = sr()
cnt_S = Counter(S)
cnt_T = Counter(T)
num_S = list(cnt_S.values())
num_T = list(cnt_T.values())

bl = num_S == num_T
print('Yes' if bl else 'No')

Submission status: Wrong Answer

Solution code:
s = input()
t = input()
li_s = list(s)
li_t = list(t)
ma = {}
for i,j in zip(li_s,li_t):
    if j not in ma:
        ma[j] = i
    elif ma[j] != i:
        print('No')
        exit()
print('Yes')

Submission status: Wrong Answer

Solution code:
s = input()
t = input()
li_s = list(s)
li_t = list(t)
ma = {}
for i,j in zip(li_s,li_t):
    if i != j:
        if j not in ma:
            ma[j] = i
        elif ma[j] != i:
            print('No')
            exit()
print('Yes')

Submission status: Wrong Answer

Solution code:
from collections import Counter

S = input()
T = input()
S_Count = Counter(S)
T_Count = Counter(T)
for i, j in S_Count.items():
    if j == 1:
        continue
    num = 0
    now = 0
    whi = ''
    flag = True
    while (num < j) and flag:
        a = S[now:].index(i)
        if whi == '':
            whi = T[a + now]
        else:
            if T[a + now] != whi:
                print('No')
                exit()
        now += a
        num += 1

for i, j in T_Count.items():
    if j == 1:
        continue
    num = 0
    now = 0
    whi = ''
    while num < j:
        a = T[now:].index(i)
        if whi == '':
            whi = S[a + now]
        else:
            if S[a + now] != whi:
                print('No')
                exit()
        now += a + 1
        num += 1


print('Yes')

Submission status: Wrong Answer

Solution code:
from collections import Counter
s = Counter(input())
t = Counter(input())
sc = [x for x in s.values()]
tc = [x for x in t.values()]
print("Yes" if sc==tc else "No")

Submission status: Wrong Answer

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

S = input()
T = input()

s_t = {}
t_s = {}

for s, t in zip(S, T):
    if s != t:
        if s not in s_t:
            s_t[s] = t
        else:
            if s_t[s] != t:
                print("No")
                exit()
        if t not in t_s:
            t_s[t] = s
        else:
            if t_s[t] != s:
                print("No")
                exit()
print("Yes")

Submission status: Wrong Answer

Solution code:
s=input()
t=input()
dic={}

for i,j in zip(s,t):
  if dic.get(j,0) != 0 and dic[j] != i:
    print("No")
    break
  else:
    dic[j] = i
else:
  print("Yes")

Submission status: Wrong Answer

Solution code:
s = input() #sys.stdin.readlineは最後が改行
t = input() #sys.stdin.readlineは最後が改行

n = len(s)

from collections import defaultdict
ds = defaultdict(list)
dt = defaultdict(list)

for i in range(n):
    if s[i] != t[i]:
        if s[i] in ds.keys():
            if ds[s[i]] != t[i]:
                print('No')
                exit()
        else:
            ds[s[i]] = t[i]

for i in range(n):
    if s[i] != t[i]:
        if t[i] in dt.keys():
            if dt[t[i]] != s[i]:
                print('No')
                exit()
        else:
            dt[t[i]] = s[i]

print('Yes')

Submission status: Wrong Answer

Solution code:
s = input() #sys.stdin.readlineは最後が改行
t = input() #sys.stdin.readlineは最後が改行

n = len(s)

from collections import defaultdict
ds = defaultdict(list)
dt = defaultdict(list)

for i in range(n):
    if s[i] != t[i]:
        if s[i] in ds.keys():
            if ds[s[i]] != t[i]:
                print('No')
                exit()
        else:
            ds[s[i]] = t[i]

        if t[i] in dt.keys():
            if dt[t[i]] != s[i]:
                print('No')
                exit()
        else:
            dt[t[i]] = s[i]

if len(ds) != len(set(ds.values())):
    print('No')
    exit()

if len(dt) != len(set(dt.values())):
    print('No')
    exit()

print('Yes')

Submission status: Wrong Answer

Solution code:
s = input() #sys.stdin.readlineは最後が改行
t = input() #sys.stdin.readlineは最後が改行

n = len(s)

from collections import defaultdict
ds = defaultdict(list)
dt = defaultdict(list)

for i in range(n):
    if s[i] != t[i]:
        if s[i] in ds.keys():
            if ds[s[i]] != t[i]:
                print('No')
                exit()
        else:
            ds[s[i]] = t[i]

        if t[i] in dt.keys():
            if dt[t[i]] != s[i]:
                print('No')
                exit()
        else:
            dt[t[i]] = s[i]

print('Yes')

Submission status: Wrong Answer

Solution code:
S = input()
T = input()
d = {}

for s, t in zip(S, T):
  if s in d:
    #含まれている場合で、tと異なるならば、変換ができないということ
    if d[s] != t:
      print("No")
      exit()
  else:
    d[s] = t

print(d)
print(len(d))
print(len(set(d.values())))

#keyの数に対し、valuesが重複していて、数が合わなければ、変換ができない
if len(d) != len(set(d.values())):
  print("No")
else:
  print("Yes")

Submission status: Wrong Answer

Solution code:
import sys

S = input()
T = input()

d = {}

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

Submission status: Wrong Answer

Solution code:
import sys

S = input()
T = input()

d = {}

for i in range(len(S)):
    if T[i] in d and d[T[i]]!=S[i]:
        print("NO")
        sys.exit()
    d[T[i]] = S[i]
print("YES")

Submission status: Wrong Answer

Solution code:
# ABC110C

import numpy as np

s = input()
t = input()
n = len(s)
s = np.array(list(s))
t = np.array(list(t))
i = -1
ok = "No"
replaced = []
while True:
    i += 1
    if i == n:
        break
    if s[i] != t[i]:
        a = s[i]
        b = t[i]
        # print(f"{a} to {b}, {b} to {a}")
        if replaced.count(a) > 0 or replaced.count(b) > 0:
            break
        replaced.append(a)
        replaced.append(b)
        for j in range(i, n):
            if s[j] == a:
                s[j] = b
            elif s[j] == b:
                s[j] = a
        # print(f"s = {s}")
        # print(f"t = {t}")
        # print("------------")
    if all(s == t):
        # print(s)
        # print(t)
        ok = "Yes"
print(ok)

Submission status: Wrong Answer

Solution code:
s = input() #sys.stdin.readlineは最後が改行
t = input() #sys.stdin.readlineは最後が改行

# --- keyエラーにならない初期化をする辞書
from collections import defaultdict
ds = defaultdict(list)
dt = defaultdict(list)

for i in range(len(s)):
    if s[i] != t[i]:
        if s[i] in ds.keys():
            if ds[s[i]] != t[i]:
                print('No')
                exit()
        else:
            ds[s[i]] = t[i]

        if t[i] in dt.keys():
            if dt[t[i]] != s[i]:
                print('No')
                exit()
        else:
            dt[t[i]] = s[i]

print('Yes')

Submission status: Wrong Answer

Solution code:
s = input() #sys.stdin.readlineは最後が改行
t = input() #sys.stdin.readlineは最後が改行

# --- keyエラーにならない初期化をする辞書
from collections import defaultdict
ds = defaultdict(list)
dt = defaultdict(list)

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

        if len(dt[t[i]]) == 0:
            dt[t[i]] = s[i]
        else:
            if dt[t[i]] != s[i]:
                print('No')
                exit()

print('Yes')

Submission status: Wrong Answer

Solution code:
s = input()
t = input()
c = [0 for i in range(len(s))]
flag = True
for i in range(len(s)):
    if c[i] == 0 and flag == True:
        for j in range(i,len(s)):
            if (s[i] == s[j] and t[i] != t[j]) or (s[i] != s[j] and t[i] == t[j]):
                flag = False
            else:
                c[j] = 1
if flag:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

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


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


def solve(S: str, T: str):
    d1 = defaultdict(set)
    for i, si in enumerate(S):
        d1[si].add(i)
    d2 = defaultdict(set)
    for i, ti in enumerate(T):
        d2[ti].add(i)
    print(YES if sorted(d1.values()) == sorted(d2.values()) else NO)


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:
s1 = input()
s2 = input()
dict_s1 = {}
dict_s2 = {}
for i in range(len(s1)):
    if s1[i] not in dict_s1:
        dict_s1[s1[i]] = s2[i]
    else:
        if dict_s1[s1[i]] != s2[i]:
            print('No')
            #quit()
    if s2[i] not in dict_s2:
        dict_s2[s2[i]] = s1[i]
    else:
        if dict_s2[s2[i]] != s1[i]:
            print('No')
            #quit()
print('Yes')

Submission status: Wrong Answer

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

st = defaultdict(lambda :0)
for x, y in zip(s,t):
    if st[y] != 0 and st[y] != x:
        print('No')
        exit()
    st[y] = x
    st[x] = y
print('Yes')

Submission status: Wrong Answer

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

st = defaultdict(lambda :0)
for x, y in zip(s,t):
    if st[y] != 0 and st[y] != x:
        print('No')
        exit()
    st[y] = x

print('Yes')

Submission status: Wrong Answer

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

st = defaultdict(lambda :0)
ts = defaultdict(lambda :0)
for x, y in zip(s,t):
    if x == y:
        if st[x] != ts[y]:
            print('No')
            exit()
        st[x] = y
        ts[y] = x
    else:
        if st[x] == 0:
            st[x] = y
            ts[y] = x
        else:
            if st[x] != y or ts[y] != x:
                print('No')
                exit()
print('Yes')

Submission status: Wrong Answer

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

st = defaultdict(lambda :0)
ts = defaultdict(lambda :0)
for x, y in zip(s,t):
    if x == y:
        if st[x] != ts[y]:
            print('No')
            exit()
        st[x] = y
        st[y] = x
    else:
        if st[x] == 0:
            st[x] = y
            ts[y] = x
        else:
            if st[x] != y or ts[y] != x:
                print('No')
                exit()
print('Yes')

Submission status: Wrong Answer

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

st = defaultdict(lambda :0)
ts = defaultdict(lambda :0)
for x, y in zip(s,t):
    if x == y:
        if st[x] != ts[y]:
            print('No')
            exit()
        st[x] = y
        st[y] = x
    else:
        if st[x] == 0:
            st[x] = y
            ts[y] = x
        else:
            if st[x] != y:
                print('No')
                exit()
print('Yes')

Submission status: Wrong Answer

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

l = defaultdict(lambda :0)
for i in range(2):
    for x, y in zip(s,t):
        if i == 0:
            if x == y:
                l[x] = x
            continue

        if l[x] == 0 and l[y] != y:
            l[x] = y

        elif x != y and (l[x] == x or l[y] == y):
            print('No')
            exit()
        elif l[x] != 0 and l[x] != y:
            print('No')
            exit()
#print(l)
print('Yes')

Submission status: Wrong Answer

Solution code:
s1 = input()
s2 = input()
dic = {}
for i in range(len(s1)):
    if not s1[i] in dic:
        dic[s1[i]] = s2[i]
    #else:
        #if dic[s1[i]] != s2[i]:
            #print('No')
            #quit()
#print('Yes')
if len(dic) != len(set(dic.values())):
    print('No')
else:
    print('Yes')

Submission status: Wrong Answer

Solution code:
s1 = input()
s2 = input()
dic = {}
for i in range(len(s1)):
    if not s1[i] in dic:
        dic[s1[i]] = s2[i]
    else:
        if dic[s1[i]] != s2[i]:
            print('No')
            quit()
print('Yes')

Submission status: Wrong Answer

Solution code:
s1 = input()
s2 = input()
dic = {}
for i in range(len(s1)):
    if not s1[i] in dic:
        dic[s1[i]] = s2[i]
if len(dic) != len(set(dic.values())):
    print('No')
else:
    print('Yes')

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
# https://atcoder.jp/contests/abc110/tasks/abc110_c

def main():
    s = input()
    t = input()

    d = {}
    for i in range(len(s)):
        if s[i] == t[i]:
            continue
        if t[i] in d and d[t[i]] != s[i]:
            print('No')
            return
        elif t[i] not in d:
            d[t[i]] = s[i]
    d = {}
    for i in range(len(s)):
        if s[i] == t[i]:
            continue
        if s[i] in d and d[s[i]] != t[i]:
            print('No')
            return
        elif s[i] not in d:
            d[s[i]] = t[i]
    print('Yes')


if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
# https://atcoder.jp/contests/abc110/tasks/abc110_c

def main():
    s = input()
    t = input()

    d = {}
    for i in range(len(s)):
        if s[i] == t[i]:
            continue
        if t[i] in d and d[t[i]] != s[i]:
            print('No')
            return
        elif t[i] not in d:
            d[t[i]] = s[i]
    print('Yes')

if __name__ == "__main__":
    main()

Submission status: Wrong Answer

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

NUMBER_OF_ALPHABETS = 26
S_length = len(S)
if S_length < NUMBER_OF_ALPHABETS:
    print('Yes')
    exit()

ALPHABETS = 'abcdefghijklmnopqrstuvwxyz'
answer = 'Yes'
for alphabet in ALPHABETS:
    i = S.find(alphabet)
    if i == -1: continue

    replaced_S = S.replace(S[i], '')
    replaced_T = T.replace(T[i], '')
    if len(replaced_S) != len(replaced_T):
        answer = 'No'
        break
print(answer)

# for i in range(S_length):
#     replaced_S = S.replace(S[i], '')
#     replaced_T = T.replace(T[i], '')
#     if len(replaced_S) != len(replaced_T):
#         answer = 'No'
#         break
# print(answer)

# 同一文字は同一位置でなければならない
# 未使用文字が存在する場合: スワップしながら可能か？
# 未使用文字が存在しない場合: 他文字と被るかどうか？

Submission status: Wrong Answer

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

NUMBER_OF_ALPHABETS = 26
S_length = len(S)
if S_length < NUMBER_OF_ALPHABETS:
    print('Yes')
    exit()

ALPHABETS = 'abcdefghijklmnopqrstuvwxyz'
answer = 'Yes'
for i in range(S_length):
    replaced_S = S.replace(S[i], '')
    replaced_T = T.replace(T[i], '')
    if len(replaced_S) != len(replaced_T):
        answer = 'No'
        break
print(answer)

# 同一文字は同一位置でなければならない
# 未使用文字が存在する場合: スワップしながら可能か？
# 未使用文字が存在しない場合: 他文字と被るかどうか？

Submission status: Wrong Answer

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

NUMBER_OF_ALPHABETS = 26
S_length = len(S)
if S_length < NUMBER_OF_ALPHABETS:
    print('Yes')
else:
    print('No')

# 同一文字は同一位置でなければならない
# 未使用文字が存在する場合: スワップしながら可能か？
# 未使用文字が存在しない場合: 他文字と被るかどうか？

Submission status: Wrong Answer

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

NUMBER_OF_ALPHABETS = 26
S_length = len(S)
if S_length <= NUMBER_OF_ALPHABETS:
    print('Yes')
else:
    print('No')

# 同一文字は同一位置でなければならない
# 未使用文字が存在する場合: スワップしながら可能か？
# 未使用文字が存在しない場合: 他文字と被るかどうか？

Submission status: Wrong Answer

Solution code:
d,d_=dict(),dict()
s,t=input(),input()
l=len(s)
for i in range(l):
    if s[i] not in d:
        d[s[i]]=[i]
    else:
        d[s[i]].append(i)
for i in range(l):
    if t[i] not in d_:
        d_[t[i]]=[i]
    else:
        d_[t[i]].append(i)
x=[i[1] for i in list(d.items())]
y=[i[1] for i in list(d_.items())]
print("Yes" if x==y else "No")

Submission status: Wrong Answer

Solution code:
from collections import defaultdict

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

ds=defaultdict(list)
dt=defaultdict(list)

for i in range(len(s)):
    ds[s[i]].append(i)
    dt[t[i]].append(i)

dsk=list(ds.values())
dtk=list(dt.values())

if dsk==dtk:
    print('MAX')
else:
    print('No')

Submission status: Wrong Answer

Solution code:
from collections import defaultdict

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

ds=defaultdict(list)
dt=defaultdict(list)

for i in range(len(s)):
    ds[s[i]].append(i)
    dt[t[i]].append(i)

dsk=list(ds.values())
dtk=list(dt.values())

if dsk==dtk:
    print('Yes')
    exit()
else:
    print('No')

Submission status: Wrong Answer

Solution code:
from collections import defaultdict

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

ds=defaultdict(list)
dt=defaultdict(list)

for i in range(len(s)):
    ds[s[i]].append(i)
    dt[t[i]].append(i)

dsk=list(ds.values())
dtk=list(dt.values())

if dsk==dtk:
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

Solution code:
from collections import defaultdict

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

ds=defaultdict(list)
dt=defaultdict(list)

for i in range(len(s)):
    ds[s[i]].append(i)
    dt[t[i]].append(i)

dsk=list(ds.keys())
dtk=list(dt.keys())

if len(dsk)==len(dtk):
    for i in range(len(dsk)):
        if ds[dsk[i]]!=dt[dtk[i]]:
            print('No')
            exit()
else:
    print('No')
    exit()

print('Yes')

Submission status: Wrong Answer

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

    spair = {}
    tpair = {}

    for s, t in zip(S, T):
        if s not in spair:
            spair[s] = t
        else:
            if spair[s] != t:
                print("No1")
                exit()
        if t not in tpair:
            tpair[t] = s
        else:
            if tpair[t] != s:
                print("No2")
                exit()

    print("Yes")


if __name__ == "__main__":
    solve()

Submission status: Wrong Answer

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

def main():
    S = input()
    T = input()
    same = set()
    for i in range(len(S)):
        if S[i] == T[i]:
            same.add(S[i])

    for i in range(len(S)):
        if S[i] != T[i]:
            if T[i] in same:
                print('No')
                exit()
    
    print('Yes')


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

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

def main():
    S = input()
    T = input()
    same = set()
    for i in range(len(S)):
        if S[i] == T[i]:
            same.add(S[i])

    for i in range(len(S)):
        if S[i] != T[i]:
            if S[i] in same or T[i] in same:
                print('No')
                exit()
    
    print('Yes')


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

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


def check(S,T):
    dic1 = {}
    dic2 = {}
    for s,t in zip(S,T):
        if s not in dic1:
            dic1[s] = t
            dic2[s] = False
        elif dic1[s] != t:
            return False
    for k in dic1.keys():
        if dic2[k]==False:
            mark = False
            first = k #最初の文字を記録する
            while True:
                dic2[k] = True
                k = dic1[k]
                if k not in dic1 or k == first: #辞書にない文字or最初の文字
                    mark = True #OK
                    break
                elif dic2[k] == True:
                    break
            if mark == False:
                return False
    return True
            

if check(S,T):
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

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

#110_c

S = input()
T = input()

combination = []
for i, j in zip(S,T):
    combination.append([i,j])

set_combination = []

for i,j in list(map(list, set(map(tuple, combination)))):
    set_combination.append(j)

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

Submission status: Wrong Answer

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

#110_c

S = input()
T = input()

all = S+T

flag = 0
for i in set(all):
    if all.count(i) % 2 == 0:
        continue
    else:
        flag = 1
        break

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

Submission status: Wrong Answer

Solution code:
# Problem C - String Transformation

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

# initialization
t_map = {}
is_ok = True

# mapping
for i in range(len(S)):
    s = S[i]
    t = T[i]
    if not t in t_map:
        t_map[t] = set([s])
    else:
        t_map[t].add(s)

# check
for t in t_map:
    if len(t_map[t])>1 and t in t_map[t]:
        is_ok = False

# output
if is_ok:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
#from statistics import median
#import collections
#aa = collections.Counter(a) # list to list
#from itertools import combinations # (string,3) 3回

mod = 10**9 + 7

def readInts():
  return list(map(int,input().split()))
def main():
    # S: azzel
    # T: apple
    S = input()
    T = input()
    ok = True
    dic_s = {}
    dic_t = {}
    for i in range(len(S)):
        s = S[i]
        t = T[i]
        if s in dic_s.keys():
            if dic_s[s] != t:
                ok = False
        if t in dic_t.keys():
            if dic_t[t] != s:
                ok = False
        dic_s[s] = t
        dic_t[t] = s
        print(dic_s,dic_t,sep='\n')
    if ok:
        print('Yes')
    else:
        print('No')



if __name__ == '__main__':
  main()

Submission status: Wrong Answer

Solution code:
import collections


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

counts_s = collections.Counter(s)
counts_t = collections.Counter(t)

print(counts_s,counts_t)

value_s = list(counts_s.values())
value_t = list(counts_t.values())


if value_s == value_t:
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
s=input()
t=input()
a,b=len(set(s)),len(set(t))
if not a==b:
  print('No')
  exit()
l=len(s)
for i in range(1,l):
  if (s[i]==s[i-1] and t[i]!=t[i-1]) or (s[i]!=s[i-1] and t[i]==t[i-1]):
    print('No')
    exit()
print('Yes')

Submission status: Wrong Answer

Solution code:
from collections import Counter
s = Counter(input())
a = [i for i in s.values()]
t = Counter(input())
b = [i for i in t.values()]
if a==b:
  print('Yes')
else:
  print("No")

Submission status: Wrong Answer

Solution code:
import collections
s=list(input())
t=list(input())
svalues, scounts = zip(*collections.Counter(s).most_common())
tvalues, tcounts = zip(*collections.Counter(t).most_common())
if len(set(s))==len(set(t)):
    if scounts==tcounts:print('Yes')
else:print('No')

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:
s = input()
t = input()
c1 = {}
c2 = {}
for i,j in zip(s,t):
  if i != j:
    if i in c1:
      if c1[i] != j:
        a = "No"
        break
    else:
      c1[i] = j
    if j in c2:
      if c2[j] != i:
        a = "No"
        break
    else:
      c2[j] = i
else:
  a = "Yes"
print(a)

Submission status: Wrong Answer

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

def can_match(s, t):
  if len(s) != len(t):
    return False
  
  # 変換テーブル
  table = {}
  
  for i in range(len(s)):
    if not s[i] in table:
      table[s[i]] = t[i]
      table[t[i]] = s[i]
      
    if table[s[i]] != t[i]:
      return False    
 
  return True

if can_match(S, T):
  print('Yes')
else:
  print('No')

Submission status: Wrong Answer

Solution code:
import sys

S = input()
T = input()
alpha_map = {}
talpha_map = {}
for i in range(len(S)):
  s = S[i]
  t = T[i]
  if s in alpha_map.keys():
    if alpha_map[s] != t:
      sys.exit()
  if t in talpha_map.keys():
    if talpha_map[t] != s:
      sys.exit()
  alpha_map[s] = t
  talpha_map[t] = s
print("Yes")

Submission status: Wrong Answer

Solution code:
import sys

S = input()
T = input()
alpha_map = {}
talpha_map = {}
for i in range(len(S)):
  s = S[i]
  t = T[i]
  if s in alpha_map:
    if alpha_map[s] != t:
      sys.exit()
  if t in talpha_map:
    if talpha_map[t] != s:
      sys.exit()
  alpha_map[s] = t
  talpha_map[t] = s
print("Yes")

Submission status: Wrong Answer

Solution code:
def main():
    import sys
    input = sys.stdin.readline
    sys.setrecursionlimit(10**7)
    from collections import Counter, deque
    #from collections import defaultdict
    from itertools import combinations, permutations, accumulate, groupby
    #from itertools import product
    from bisect import bisect_left,bisect_right
    from heapq import heapify, heappop, heappush
    from math import floor, ceil
    #from operator import itemgetter

    #inf = 10**17
    #mod = 10**9 + 7

    s = input().rstrip()
    t = input().rstrip()
    alphabet = 'abcdefghijklmnopqrstuvwxyz' #26

    for a in alphabet:
        l = []
        for i in range(len(s)):
            if t[i] == a:
                l.append(s[i])
        if len(set(l)) > 1:
            print('No')
            exit()
    print('Yes')

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

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

def encode(S):
  dict={}
  now=0
  result=""
  for s in S:
    if s not in dict.keys():
      dict[s]=str(now)
      now+=1
      result=result+dict[s]
  return result

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

Submission status: Wrong Answer

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

def encode(S):
  dict={}
  now=0
  result=""
  for s in S:
    if s not in dict.keys():
      dict[s]=str(now)
      now+=1
      result=result+dict[s]
  return result

if encode(S)!=encode(T):
  print("No")
else:
  if len(set(S))%2==1:
    print("No")
  else:
    print("Yes")

Submission status: Wrong Answer

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

def encode(S):
  dict={}
  now=0
  result=""
  for s in S:
    if s not in dict.keys():
      dict[s]=str(now)
      now+=1
      result=result+dict[s]
  return result

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

Submission status: Wrong Answer

Solution code:
def main():
    import copy
    s, t = input(), input()
    a = [[] for _ in range(26)]
    b = copy.deepcopy(a)
    for i, j in zip(s, t):
        x, y = map(lambda x: ord(x) - 97, [i, j])
        a[x].append(y)
        b[y].append(x)

    f = all(len(set(i)) <= 1 for i in a)
    g = all(len(set(i)) <= 1 for i in a)
    print("Yes" if f and g else "No")


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
def main():
    import copy
    s, t = input(), input()
    a = [[] for _ in range(26)]
    b = copy.deepcopy(a)
    for i, j in zip(s, t):
        x, y = map(lambda x: ord(x) - 97, [i, j])
        a[x].append(y)
        b[y].append(x)

    f = all(len(set(i)) for i in a)
    g = all(len(set(i)) for i in a)
    print("Yes" if f and g else "No")


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
def main():
    from collections import defaultdict
    s, t = input(), input()
    d = defaultdict()

    for a, b in zip(s, t):
        if a == b:
            continue
        x, y = d.get(a), d.get(b)
        if (x, y) == (None, None):
            d[a], d[b] = b, a
        elif x is None or y is None:
            print("No")
            break
        else:
            if x != b or y != a:
                print("No")
                break
    else:
        print("Yes")
    print(d)

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
def main():
    from collections import defaultdict
    s, t = input(), input()
    v = ['' for _ in range(26)]
    d = defaultdict()

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

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
def main():
    s, t = input(), input()
    v = ['' for _ in range(26)]

    for i in range(len(s)):
        a, b = s[i], t[i]
        k = ord(a) - 97
        if v[k] == '' or v[k] == b:
            v[k] = b
            if v.count(b) > 1:
                print('No')
                break
    else:
        print('Yes')

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
def main():
    s, t = input(), input()
    u = [chr(i) for i in range(97, 97 + 26)]
    v = [[] for _ in range(26)]

    for i in range(len(s)):
        a, b = s[i], t[i]
        k = u.index(a)
        v[k].append(b)

    f = all(len(set(i)) <= 1 and v.count(i) == 1 for i in v)
    print('Yes' if f else 'No')


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
def main():
    s, t = input(), input()
    u = [chr(i) for i in range(97, 97 + 26)]
    v = [[] for _ in range(26)]

    for i in range(len(s)):
        a, b = s[i], t[i]
        k = u.index(a)
        v[k].append(b)

    f = all(len(set(i)) <= 1 for i in v)
    print('Yes' if f else 'No')


if __name__ == '__main__':
    main()