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:
import sys

s = input()
t = input()

def replacement(word, a, b):
    return word.replace(a, "0").replace(b, a).replace("0", b)

yet_list = []
for i in range(len(s)):
    if s[i] in yet_list:
        print("No")
        sys.exit()
    if s[i] != t[i]:
        if not s[i] in yet_list:
            s = replacement(s, s[i], t[i])
            yet_list.append(s[i])
            yet_list.append(t[i])
if s == t:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
import sys
input=sys.stdin.readline

def main():
    S = input().strip()
    T = input().strip()
    A = [[] for i in range(26)]
    for i,c in enumerate(T):
        a = A[ord(c)-ord("a")]
        if len(a) == 0:
            a.append(S[i])
        elif len(a) == 1 and S[i] in a:
            pass
        else:
            print("No")
            return
    print("Yes")

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
import sys
input=sys.stdin.readline

def main():
    S = input().strip()
    T = input().strip()
    ds = {}
    dt = {}
    for s in S:
        if s in ds:
            ds[s] += 1
        else:
            ds[s] = 1
    for t in T:
        if t in dt:
            dt[t] += 1
        else:
            dt[t] = 1
    ds = sorted(ds.items(), key=lambda x:x[0])
    dt = sorted(dt.items(), key=lambda x:x[0])

    if len(ds) != len(dt):
            print("No")
            return
    for i in range(len(ds)):
        if ds[i][1] != dt[i][1]:
            print("No")
            return
    print("Yes")

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

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

    d={}

    for i in range(len(s)):
        si=s[i]
        ti=t[i]
        if not si in d:
            d[si]=ti
        else:
            if d[si]==ti:
                continue
            else:
                return "No"
            
    vals=d.values()
    if len(vals)==len(set(vals)):
        return "Yes"
    else:
        return "No"

Submission status: Wrong Answer

Solution code:
from collections import Counter

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

if Counter(sorted(S)).values() == Counter(sorted(T)).values():
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
import sys

stdin = sys.stdin

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip()  # ignore trailing spaces

s = input()
t = input()
ans = "Yes"
d1 = {}
d2 = {}
for i in range(len(s)):
    if s[i] == t[i]:
        continue
    else:
        if s[i] in d1:
            if d1[s[i]] != t[i]:
                ans = "No"
                break
        else:
            d1[s[i]] = t[i]
        if t[i] in d2:
            if d2[t[i]] != s[i]:
                ans = "No"
                break
        else:
            d2[t[i]] = s[i]
print(ans)

Submission status: Wrong Answer

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

    ok = True
    dic = {}
    for i in range(len(s)):
        if t[i] in dic:
            if dic[t[i]] != s[i]:
                ok = False
                break
        else:
            dic[t[i]] = s[i]
    if ok:
        print("Yes")
    else:
        print("No")


if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
print('Yes')

Submission status: Wrong Answer

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

pairs = {}

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

Submission status: Wrong Answer

Solution code:
import sys
S = input()
T = input()
used = set()
siz = len(S)

def swap_str(strin, str1, str2, tmp='9dh29'):
  return strin.replace(str1,tmp).replace(str2, str1).replace(tmp, str2)

for i in range(siz):
  if S[i] == T[i]:
    continue
  if T[i] in used:
    print('No')
    sys.exit()
  S = swap_str(S, S[i], T[i])
  used.add(T[i])
print('Yes')

Submission status: Wrong Answer

Solution code:
import collections

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

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

Submission status: Wrong Answer

Solution code:
from collections import defaultdict

def main():
    S = input()
    T = input()

    S_cnt = defaultdict(int)
    T_cnt = defaultdict(int)

    for i in range(len(S)):
        S_cnt[S[i]] += 1
        T_cnt[T[i]] += 1

    sort_S = sorted(S_cnt.items(), key=lambda x:x[1])
    sort_T = sorted(T_cnt.items(), key=lambda x:x[1])


    if len(sort_S) != len(sort_T):
        print('No')
        exit

    for i in range(len(sort_S)):
        if sort_S[i][1] != sort_T[i][1]:
            print('No')
            exit()

    print('Yes')

main()

Submission status: Wrong Answer

Solution code:
from collections import Counter

S = Counter(input())
T = Counter(input())

ss,tt = [],[]

for s,t in zip(S,T):
	ss.append(S[s])
	tt.append(T[t])

if ss == tt:
	print('Yes')
else:
	print('No')

Submission status: Wrong Answer

Solution code:
s = input()
t = input()
a = {} ; b = {}
for c, d in zip(s, t) :
    if a.setdefault(c, d) != d : print(c, d); print("No") ; break
    if b.setdefault(d, c) != c : print("No") ; break
else : print("Yes")

Submission status: Wrong Answer

Solution code:
s = input()
t = input()
a = b = {}
for c, d in zip(s, t) :
    if a.setdefault(c, d) != d : print("No") ; break
    if b.setdefault(d, c) != c : print("No") ; break
else : print("Yes")

Submission status: Wrong Answer

Solution code:
S=input()
T=input()
dic={}
change=[]
for s,t in zip(S,T):
  if s!=t:
    if s not in dic:
      dic.setdefault(s,t)
      s=dic[s]
      change.append(s)
    else:
      s=dic[s]
      change.append(s)
  else:
    change.append(s)
print("Yes" if "".join(change)==T else "No")

Submission status: Wrong Answer

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

SS = [s for s in S]
SS_set = list(set(SS))
CS = []
for c in SS_set:
  C_idx_in_S = [i for i, x in enumerate(SS) if x==c]
  if len(C_idx_in_S) > 1:
    CS += C_idx_in_S

TT = [t for t in T]
TT_set = list(set(TT))
CT = []
for c in TT_set:
  C_idx_in_T = [i for i, x in enumerate(TT) if x==c]
  if len(C_idx_in_T) > 1:
    CT += C_idx_in_T
    
if set(CS) == set(CT):
  print("Yes")
else:
  print("No")

Submission status: Wrong Answer

Solution code:
import math
import sys
import queue
from collections import Counter
from itertools import accumulate
from fractions import gcd
from functools import reduce


def lcm(a, b):
    return a * b // gcd(a, b)

def combination_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

def permutations_count(n, r):
    return math.factorial(n) // math.factorial(n - r)

sys.setrecursionlimit(10000)

mod = 1000000007

"""
# 0埋め, 小数点出力桁指定時のときの出力
a = 100
b = 0.987654321
print("{0:06d}-{1:6f}".format(a,b))
000100-0.987654

# 文字列をリストに格納
char_list = list("abcd") # ["a","b","c","d"]

# 標準入力取得
## 文字列
    = sys.stdin.readline().rstrip()
    = list(sys.stdin.readline().rstrip())

## 数値
    = int(sys.stdin.readline())
    = map(int, sys.stdin.readline().split())
    = list(map(int, sys.stdin.readline().split()))
    = [list(map(int,list(sys.stdin.readline().split()))) for i in range(N)]
"""

if __name__ == "__main__":
    S = list(sys.stdin.readline().rstrip())
    T = list(sys.stdin.readline().rstrip())

    Sc = Counter(S)
    Tc = Counter(T)
    if list(Sc.values()).sort() == list(Tc.values()).sort():
        print("Yes")
    else:
        print("No")

Submission status: Wrong Answer

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

a = {}
#ans = True
ans = False

for i in range(len(s)):
    # print('\n# i: ' + str(i))
    # print(s[i])
    # print(t[i])
    # print(a)
    if s[i] != t[i]:
        if s[i] not in a:
            if t[i] not in a.values():
                a[s[i]] = t[i]
                ans = True
    else:
        ans = True

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

Submission status: Wrong Answer

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

a = {}
#ans = True
ans = False

for i in range(len(s)):
    # print('\n# i: ' + str(i))
    # print(s[i])
    # print(t[i])
    # print(a)
    if s[i] != t[i]:
        if s[i] not in a:
            if t[i] not in a.values():
                a[s[i]] = t[i]
                ans = True

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

Submission status: Wrong Answer

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

a = {}
ans = True

for i in range(len(s)):
    # print('\n# i: ' + str(i))
    # print(s[i])
    # print(t[i])
    # print(a)
    if s[i] != t[i]:
        if s[i] in a:
            if a[s[i]] != t[i]:
                ans = False
        else:
            if t[i] in a.values():
                ans = False
            else:
                a[s[i]] = t[i]

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

Submission status: Wrong Answer

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

a = {}
ans = True

for i in range(len(s)):
    # print('\n# i: ' + str(i))
    # print(s[i])
    # print(t[i])
    # print(a)
    if s[i] != t[i]:
        if s[i] in a:
            if a[s[i]] != t[i]:
                ans = False
        else:
            if t[i] in a.values():
                ans = False
            else:
                a[s[i]] = t[i]

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

Submission status: Wrong Answer

Solution code:
import math
import sys
import queue
from collections import Counter
from itertools import accumulate
from fractions import gcd
from functools import reduce


def lcm(a, b):
    return a * b // gcd(a, b)

def combination_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

def permutations_count(n, r):
    return math.factorial(n) // math.factorial(n - r)

sys.setrecursionlimit(10000)

mod = 1000000007

"""
# 0埋め, 小数点出力桁指定時のときの出力
a = 100
b = 0.987654321
print("{0:06d}-{1:6f}".format(a,b))
000100-0.987654

# 文字列をリストに格納
char_list = list("abcd") # ["a","b","c","d"]

# 標準入力取得
## 文字列
    = sys.stdin.readline().rstrip()
    = list(sys.stdin.readline().rstrip())

## 数値
    = int(sys.stdin.readline())
    = map(int, sys.stdin.readline().split())
    = list(map(int, sys.stdin.readline().split()))
    = [list(map(int,list(sys.stdin.readline().split()))) for i in range(N)]
"""

if __name__ == "__main__":
    S = list(sys.stdin.readline().rstrip())
    T = list(sys.stdin.readline().rstrip())

    Sc = Counter(S)
    Tc = Counter(T)
    if list(Sc.values()) == list(Tc.values()):
        print("Yes")
    else:
        print("No")

Submission status: Wrong Answer

Solution code:
#s = list(map(str, input().split()))
s = list(input())
t = list(input())
#print(range(len(s)))
conv = list()
lookup = dict()
for i in range(len(s)):
#  if(s[i] not in lookup or t[i] not in lookup):
  lookup[s[i]] = t[i] # enter a new lookup entry
  lookup[t[i]] = s[i] # reverse lookup

for i in range(len(s)):
  if(s[i] not in lookup):
    print("Nooo")
    exit()
  conv.append(lookup[s[i]])

print(conv)
if(t == conv):
  print("Yes")
else:
  print("No")

Submission status: Wrong Answer

Solution code:
import collections as c
s = list(str(input()))
t = list(str(input()))
st = list(c.Counter(s+t).values())
st = sorted(st, reverse=True)
for i in range(len(st)):
    if st[i]%2 != 0 and st[i] != 1 :
        print('No')
        break
else:
    print('Yes')

Submission status: Wrong Answer

Solution code:
#s = list(map(str, input().split()))
s = list(input())
t = list(input())
#print(range(len(s)))
conv = list()
lookup = dict()
for i in range(len(s)):
  if(s[i] not in lookup):
    lookup[s[i]] = t[i] # enter a new lookup entry
  conv.append(lookup[s[i]])

if(t == conv):
  print("Yes")
else:
  print("No")

Submission status: Wrong Answer

Solution code:
#s = list(map(str, input().split()))
s = list(input())
t = list(input())
#print(range(len(s)))

lookup = dict()
for i in range(len(s)):
  if(t[i] not in lookup):
    lookup[t[i]] = s[i] # enter a new lookup entry
#    print("lookup["+s[i]+"] <- " + t[i])
  elif(lookup[t[i]] == s[i]):
    pass # go to next char
  else:
    print("No")
    exit()
print("Yes")

Submission status: Wrong Answer

Solution code:
S=str(input())
T=str(input())
s=list(S)
t=list(T)
s.sort()
t.sort()
import collections
ss=collections.Counter(s)
tt=collections.Counter(t)
ans=0
for i in range(len(set(s))):
    if ss.most_common()[i][1]>=2:
        if ss.most_common()[i][0] in t:
            if ss.most_common()[i][1]!=T.count(str(ss.most_common()[i][0])):
                print('No')
                ans=1
                break
for i in range(len(set(t))):
    if tt.most_common()[i][1]>=2:
        if tt.most_common()[i][0] in s:
            if tt.most_common()[i][1]!=S.count(str(tt.most_common()[i][0])):
                print('No')
                ans=1
                break
else:
    if ans==0:
        print('Yes')

Submission status: Wrong Answer

Solution code:
import collections as C
import sys
s = input()
t = input()

if len(set(s)) != len(set(t)):
    print("NO")
    sys.exit()

ans = [0] * len(s)
stock = C.Counter([])
for i in range(len(s)):
    if s[i] not in stock.keys():
        stock[s[i]] = t[i]
    ans[i] = stock[s[i]]

ss = "".join(ans)

print("Yes") if ss == t else print("No")

Submission status: Wrong Answer

Solution code:
import collections as C
import sys
s = input()
t = input()

if len(set(s)) != len(set(t)):
    print("NO")
    sys.exit()

ans = [0] * len(s)
stock = C.Counter([])
for i in range(len(s)):
    if s[i] not in stock.keys():
        stock[s[i]] = t[i]
    ans[i] = stock[s[i]]

ss = "".join(ans)

print("YES") if ss == t else print("NO")

Submission status: Wrong Answer

Solution code:
# 2019/08/16

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

c1={}
c2={}
for ss,tt in zip(s,t):
    c1[ss]=c1.get(ss,'')+tt
    c2[tt]=c2.get(tt,'')+ss
    if len(c1[ss])<2 and len(c2[tt])<2:continue
    if set(c1[ss])==ss and set(c2[tt])==tt:continue
    else:
        print('No')
        exit()

print('Yes')

Submission status: Wrong Answer

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

s = list(str(input()))
t = list(str(input()))
flag = 'Yes'
jskip = []
for i in range(len(s)):
    f = True
    for j in range(len(jskip)):
        if jskip[j] == s[i]:
            f = False
            break
    if f == True:
        for j in range(i):
            if s[i] == s[j] and t[i] != t[j]:
                flag = 'No'
                break
            elif t[i] == t[j] and s[i] != s[j]:
                flag = 'No'
                break
            elif s[i] == s[j] and t[i] == t[j]:
                jskip.append(s[i])
    if flag == 'No':
        break

print(flag)

Submission status: Wrong Answer

Solution code:
s = input()
t = input()
dic = {}
for i in range(len(s)):
    if str(s[i]) not in dic.keys():
        dic[str(s[i])] = 1
    else:
        dic[str(s[i])] += 1
    if str(t[i]) not in dic.keys():
        dic[str(t[i])] = 1
    else:
        dic[str(t[i])] += 1
key = 1
for i in dic.values():
    if i%2 != 0:
        key = 0
        break
if key == 1:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
import string

S = input()
T = input()

count1 = [0] * 26
count2 = [0] * 26


for j in range(26):
    count1[j] = S.count(string.ascii_lowercase[j])
    count2[j] = T.count(string.ascii_lowercase[j])

hantei = 1

for i in range(0,len(S)+1):
    count_tmp1 = 0
    count_tmp2 = 0
    for j in range(26):
        if i == count1[j] :
            count_tmp1 += 1
    for j in range(26):
        if i == count2[j] :
            count_tmp2 += 1
    if count_tmp1 != count_tmp2:
        print(count_tmp1,count_tmp2,i)
        hantei = 0
        break

if hantei == 0:
    print("No")
else:
    print("Yes")

Submission status: Wrong Answer

Solution code:
import string

S = input()
T = input()

count1 = [0] * 26
count2 = [0] * 26


for j in range(26):
    count1[j] = S.count(string.ascii_lowercase[j])
    count2[j] = T.count(string.ascii_lowercase[j])

hantei = 1

for i in range(0,len(S)+1):
    count_tmp1 = 0
    count_tmp2 = 0
    for j in range(26):
        if i == count1[j] :
            count_tmp1 += 1
    for j in range(26):
        if i == count2[j] :
            count_tmp2 += 1
    if count_tmp1 != count_tmp2:
        print(count_tmp1,count_tmp2,i)
        hantei = 0
        break

if hantei == 0:
    print("No")
else:
    print("Yes")

Submission status: Wrong Answer

Solution code:
import string

S = input()
T = input()

count1 = [0] * 26
count2 = [0] * 26


for j in range(25):
    count1[j] = S.count(string.ascii_lowercase[j])
    count2[j] = T.count(string.ascii_lowercase[j])

hantei = 1

for i in range(1,len(S)+1):
    count_tmp1 = 0
    count_tmp2 = 0
    for j in range(25):
        if i == count1[j] :
            count_tmp1 += 1
        elif i == count2[j] :
            count_tmp2 += 1
    if count_tmp1 != count_tmp2:
        hantei = 0
        break

if hantei == 0:
    print("No")
else:
    print("Yes")

Submission status: Wrong Answer

Solution code:
import string

S = input()
T = input()

S1 = sorted(S)
T1 = sorted(T)

count1 = 0
count2 = 0

for j in range(26):
    for i in range(len(S1)):
        if string.ascii_lowercase[j] == S1[i]:
            count1 += 1
            break
    for i in range(len(T1)):
        if string.ascii_lowercase[j] == T1[i]:
            count2 += 1
            break

if count1 == count2:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

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

count = {}

for i, s in enumerate(S) :
    if T[i] in count :
        count[T[i]].append(s)
    else :
        count[T[i]] = [s]

for i, item in count.items() :
    if len(set(item)) >= 2 :
        print('No')
        break
else :
    print('Yes')

Submission status: Wrong Answer

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

count = 0

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

print("Yes" if count % 2 == 0 else "No")

Submission status: Wrong Answer

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

t_samelist=[]

for i in range(len(T)):
    same=set()
    for j in range(i+1,len(T)):
        if T[i]==T[j]:
            same.add(i)
            same.add(j)
    if len(same)>=1:
        t_samelist.append(list(same))

ans="Yes"

for i in range(len(t_samelist)):
    for j in range(len(t_samelist[i])-1):
        if S[j]!=S[j+1]:
            ans="No"
            break
    else:
        continue
    break

print(ans)

Submission status: Wrong Answer

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

dic_s = {}
for i in range(len(s)):
    if s[i] not in dic_s.keys():
        dic_s[s[i]] = [i]
    else:
        dic_s[s[i]].append(i)

dic_t = {}
for i in range(len(t)):
    if t[i] not in dic_t.keys():
        dic_t[t[i]] = [i]
    else:
        dic_t[t[i]].append(i)

if list(dic_s.values()) == list(dic_t.values()):
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

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


buff = [-100 for i in range(98)]

_len = len(S)

for i in range(_len):
    if buff[ord(T[i])-97] == -100:
        buff[ord(T[i])-97] = ord(S[i])-97
    else:
        if buff[ord(T[i])-97] != ord(S[i])-97:
            # print(buff[ord(T[i])-97], T[i], S[i])
            # print(i)
            print('No')
            exit()


print('Yes')

Submission status: Wrong Answer

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


buff = [-1 for i in range(98)]

_len = len(S)

for i in range(_len):
    if buff[ord(T[i])-97] == -1:
        buff[ord(T[i])-97] = ord(S[i])-97
    else:
        if buff[ord(T[i])-97] != ord(S[i])-97:
            # print(buff[ord(T[i])-97], T[i], S[i])
            # print(i)
            print('No')
            exit()


print('Yes')

Submission status: Wrong Answer

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

n = int(len(s))
match = []
for i in range(n):
    if s[i] == t[i]:
        match.append(s[i])

count = 0
for i in range(len(t)):
    if t[i] in match and s[i] != t[i]:
        count = 1

if count == 1:
    print('No')
else:
    print('Yes')

Submission status: Wrong Answer

Solution code:
# それぞれがそれぞれに対応している必要がある
s = input()
t = input()
sd, td = {}, {}
for i in range(len(s)):
    if s[i] not in sd and t[i] not in td:
        sd[s[i]] = t[i]
        td[t[i]] = s[i]
    else:
        # if sd[s[i]] != t[i] or td[t[i]] != s[i]:
        if s[i] in sd and t[i] in td:
            pass
        else:
            print("No")
            exit()

for k in sd.keys():
    if k in sd.values():
        print("No")
        exit()

print("Yes")

Submission status: Wrong Answer

Solution code:
# それぞれがそれぞれに対応している必要がある
s = input()
t = input()
sd, td = {}, {}
for i in range(len(s)):
    if s[i] not in sd and t[i] not in td:
        sd[s[i]] = t[i]
        td[t[i]] = s[i]
    else:
        # if sd[s[i]] != t[i] or td[t[i]] != s[i]:
        if s[i] in sd and t[i] in td:
            pass
        else:
            print("No")
            exit()

print("Yes")

Submission status: Wrong Answer

Solution code:
import sys
from collections import deque

sys.setrecursionlimit(4100000)


def inputs(num_of_input):
    ins = [input() for i in range(num_of_input)]
    return ins


def solve(inputs):
    S = inputs[0]
    T = inputs[1]

    appeared_s = {}
    appeared_t = {}
    for i, _ in enumerate(S):
        if T[i] in appeared_t:
            if not appeared_t[T[i]] == S[i]:
                return "No"
            if not appeared_s[S[i]] == T[i]:
                return "No"

        else:
            appeared_t[T[i]] = S[i]
            appeared_s[S[i]] = T[i]
    return "Yes"


def string_to_int(string):
    return list(map(int, string.split()))


if __name__ == "__main__":
    ret = solve(inputs(2))
    print(ret)

Submission status: Wrong Answer

Solution code:
import sys
from collections import deque

sys.setrecursionlimit(4100000)


def inputs(num_of_input):
    ins = [input() for i in range(num_of_input)]
    return ins


def solve(inputs):
    S = inputs[0]
    T = inputs[1]

    appeared = {}
    for i, _ in enumerate(S):
        if T[i] in appeared:
            if not appeared[T[i]] == S[i]:
                return "No"
        else:
            appeared[T[i]] = S[i]
    return "Yes"


def string_to_int(string):
    return list(map(int, string.split()))


if __name__ == "__main__":
    ret = solve(inputs(2))
    print(ret)

Submission status: Wrong Answer

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

alpha2num = lambda c: ord(c) - ord('a') + 1

a2n = [[] for i in range(27)]

for i in range(len(s)):
    if len(a2n[alpha2num(t[i])]) == 1:
        if a2n[alpha2num(t[i])][0] != s[i]:
            print('No')
            exit()
        else:
            continue
    
    a2n[alpha2num(t[i])].append(s[i])
    
print('Yes')

Submission status: Wrong Answer

Solution code:
import sys
s0,t0=input(),input()
s,t=list(s0),list(t0)
n=len(s)
sn=set(s)
tn=set(t)
if len(sn)!=len(tn) or len(s)!=len(t):
  print('No')
else:
  print('Yes')

Submission status: Wrong Answer

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


ans='Yes'
st=[0]*26
ts=[0]*26
for i in range(len(s)):
    sind = ord(s[i])-ord('a')
    tind = ord(t[i])-ord('a')
    
    if st[sind] == 0:
        st[sind] == t[i]
    if ts[tind] == 0:
        ts[tind] == s[i]
    if st[sind] == t[i] and ts[tind] == s[i]:
        continue
    else:
        ans='No'
        break
    
print(ans)

Submission status: Wrong Answer

Solution code:
S = input()
T = input()
alp = "abcdefghijklmnopqrstuvwxyz"
A = [0]*26
for i in range(len(S)):
    if A[alp.index(T[i])] == 0:
        A[alp.index(T[i])] = S[i]
    elif A[alp.index(T[i])] != S[i]:
        print("No")
        exit()
print("Yes")

Submission status: Wrong Answer

Solution code:
s1 = list(input())
s2 = list(input())
s1.sort()
s2.sort()

li = []
for i in range(len(s1)):
    if s1[i]!=s2[i] and (s2[i] in s1) and s2[s1.index(s2[i])] != s1[s1.index(s2[i])]:
        
        print("No")
        break

else:
    print("Yes")

Submission status: Wrong Answer

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


ans='Yes'
st=[0]*26
for i in range(len(s)):
    sind = ord(s[i])-ord('a')
    
    if st[sind] == 0:
        st[sind] == t[i]
    elif st[sind] == t[i]:
        continue
    else:
        ans='No'
        break
    
print(ans)

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python3
from collections import defaultdict
from collections import deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
import itertools
sys.setrecursionlimit(10**5)
stdin = sys.stdin
bisect_left = bisect.bisect_left
bisect_right = bisect.bisect_right
def LI(): return list(map(int, stdin.readline().split()))
def LF(): return list(map(float, stdin.readline().split()))
def LI_(): return list(map(lambda x: int(x)-1, stdin.readline().split()))
def II(): return int(stdin.readline())
def IF(): return float(stdin.readline())
def LS(): return list(map(list, stdin.readline().split()))
def S(): return list(stdin.readline().rstrip())
def IR(n): return [II() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def FR(n): return [IF() for _ in range(n)]
def LFR(n): return [LI() for _ in range(n)]
def LIR_(n): return [LI_() for _ in range(n)]
def SR(n): return [S() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
mod = 1000000007
inf = float('INF')

#A
def A():
    a = LI()
    a.sort()
    a, b, c = a
    print(int(str(c)+str(b))+a)
    return

#B
def B():
    _, _, X, Y = LI()
    x = LI()
    y = LI()
    x.append(X)
    y.append(Y)
    x.sort()
    y.sort()
    print("No " * (x[-1] < y[0]) + "War")
    return

#C
def C():
    s = S()
    t = S()
    d = defaultdict(str)
    for i in range(97, 97 + 27):
        d[chr(i)] = chr(i)
    check = [0] * 27
    for i in range(len(s)):
        if d[s[i]] == t[i]:
            continue
        if check[ord(s[i]) - 97]:
            print("No")
            return
        check[ord(s[i]) - 97] = 1
        d[s[i]] = t[i]
    print("Yes")
    return

#D
def D():
    return

#Solve
if __name__ == '__main__':
    C()

Submission status: Wrong Answer

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

end = []
flag = 1
for i in range(len(s)):
  if s[i] not in end:
    end.append(s[i])
    for j in range(len(t)):
      if s[i] == s[j]:
        if t[i] != t[j]:
          flag = 0

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

Submission status: Wrong Answer

Solution code:
import numpy as np


s = input()
t = input()


ds = {}
dt = {}

for c in s:
    if c not in ds:
        ds[c] = 1

for c in t:
    if c not in dt:
        dt[c] = 1

if len(ds) == len(dt):
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

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

d = dict()
for i, c in enumerate(T):
    if d.get(c) is None:
        d[c] = [i]
    else:
        d[c].append(i)

for c, indices in d.items():
    if len(indices) < 2:
        continue
    s_slice = list(map(lambda i: S[i], indices))
    if any([s_slice[0] != s_i for s_i in s_slice]):
        print('No')
        exit(0)
print('Yes')

Submission status: Wrong Answer

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

ng = ''
for i in range(len(S)):
    if S[i] == T[i]:
        ng += S[i]
for i in range(len(S)):
    fr = S[i]
    to = T[i]
    if fr != to and (fr in ng or to in ng):
        print('No')
        exit(0)
print('Yes')

Submission status: Wrong Answer

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

sl = {}
tl = {}

for i in range(len(s)):
    if s[i] in sl:
        sl[s[i]] += 1
    else:
        sl[s[i]] = 1
    if t[i] in tl:
        tl[t[i]] += 1
    else:
        tl[t[i]] = 1

sll = [i for i,j in sl.items() if j > 1]
tll = [i for i,j in tl.items() if j > 1]
ss = []
tt = []

for i in range(len(s)):
    if s[i] in sll:
        ss.append(i)
    if t[i] in tll:
        tt.append(i)

if len(set(s)) != len(set(t)):
    print("No")
else:
    if ss != tt:
        print("No")
    else:
        print("Yes")

Submission status: Wrong Answer

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

sl = {}
tl = {}

for i in range(len(s)):
    if s[i] in sl:
        sl[s[i]] += 1
    else:
        sl[s[i]] = 1
    if t[i] in tl:
        tl[t[i]] += 1
    else:
        tl[t[i]] = 1

sll = [i for i,j in sl.items() if j > 1]
tll = [i for i,j in tl.items() if j > 1]
ss = 0
tt = 0

for i in range(len(s)):
    if s[i] in sll:
        ss += i
    if t[i] in tll:
        tt += i

if len(set(s)) != len(set(t)):
    print("No")
else:
    if ss != tt:
        print("No")
    else:
        print("Yes")

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:
import sys
from collections import Counter
s = Counter(input())
t = Counter(input())
for i, j in zip(s, t):
    if s[i] != t[j]:
        print('No')
        sys.exit(0)
print('Yes')

Submission status: Wrong Answer

Solution code:
from collections import defaultdict
s = input()
t = input()
dic = defaultdict(lambda : None)
revdic = defaultdict(lambda : None)
for x, y in zip(s, t):
    if dic[x] == None and revdic[y] == None:
        dic[x] = y
        dic[y] = x
    elif dic[x] != y or revdic[y] != x:
        print('No')
        quit()
print('Yes')

Submission status: Wrong Answer

Solution code:
from collections import defaultdict
s = input()
t = input()
dic = defaultdict(lambda : None)
for x, y in zip(s, t):
    if dic[x] == None and dic[y] == None:
        dic[x] = y
        dic[y] = x
    elif dic[x] != y or dic[y] != x:
        print('No')
        quit()
print('Yes')

Submission status: Wrong Answer

Solution code:
from collections import defaultdict
s = input()
t = input()
dic = defaultdict(lambda : None)
for x, y in zip(s, t):
    if dic[x] == None:
        dic[x] = y
    elif dic[x] != y:
        print('No')
        quit()
print('Yes')

Submission status: Wrong Answer

Solution code:
from collections import defaultdict
s = input()
t = input()
dic = defaultdict(lambda : None)
revdic = defaultdict(lambda : None)
for x, y in zip(s, t):
    while dic[x] != None:
        x = dic[x]
    if x == y:
        continue
    if dic[x] == None and revdic[y] == None:
        dic[x] = y
        revdic[y] = x
    else:
        print('No')
        quit()
print('Yes')

Submission status: Wrong Answer

Solution code:
from collections import defaultdict
s = input()
t = input()
dic = defaultdict(lambda : None)
used = defaultdict(lambda : False)
for x, y in zip(s, t):
    while dic[x] != None:
        x = dic[x]
    if x == y:
        continue
    if used[y] == False:
        dic[x] = y
        used[y] = True
    else:
        print('No')
        quit()
print('Yes')