Problem:


Score : 300 points

Problem Statement

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

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

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

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

Constraints

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

|S| = |T|

S and T consists of lowercase English letters.

Input

Input is given from Standard Input in the following format:

S
T

Output

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

Sample Input 1

azzel
apple

Sample Output 1

Yes

azzel can be changed to apple, as follows:

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

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

Sample Input 2

chokudai
redcoder

Sample Output 2

No

No sequences of operation can change chokudai to redcoder.

Sample Input 3

abcdefghijklmnopqrstuvwxyz
ibyhqfrekavclxjstdwgpzmonu

Sample Output 3

Yes



Sample input:
azzel
apple


Sample output:
Yes

Submission status: Wrong Answer

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

s_s = set(s)
t_s = set(t)

print(['No','Yes'][len(s_s) == len(t_s)])

Submission status: Wrong Answer

Solution code:
import collections
S = input()
L = []
M = []
c = collections.Counter(S)
for x in c.items():
    L.append(x[1])
T = input()
c = collections.Counter(T)
for x in c.items():
    M.append(x[1])
if M == L:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
a = int('a', 36)
S = list(input())
T = list(input())

s_index = [[] for i in range(28)]
t_index = [[] for i in range(28)]

for i in range(len(S)):
  s_index[int(S[i], 36) - a].append(i)
  t_index[int(T[i], 36) - a].append(i)

s_index = sorted(s_index)
t_index = sorted(t_index)

print(s_index)
print(t_index)

if s_index == t_index:
  print('Yes')
else:
  print('No')

Submission status: Wrong Answer

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


if set(list(s)) != set(list(t)):
    print("No")
    exit()

# ある1文字に対応する文字が1種であることを確認
d = dict()
for si, ti in zip(s, t):
    if si not in d:
        d[si] = ti
    else:
        if d[si] != ti:
            print("No")
            exit()
print("Yes")

Submission status: Wrong Answer

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

for i in range(len(s)):
    if s[i] == t[i]:
        continue
    else:
        s = s.translate(str.maketrans({s[i]: t[i], t[i]: s[i]}))
        if s == t:
            print("Yes")
            exit()

print("No")

Submission status: Wrong Answer

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

for i in range(len(s)):
    if s[i] == t[i]:
        continue
    else:
        s = s.translate(str.maketrans({s[i]: t[i], t[i]: s[i]}))
if s == t:
    print("yes")
else:
    print("no")

Submission status: Wrong Answer

Solution code:
from collections import defaultdict

S = input()
T = input()

d = defaultdict(lambda: '')
flag = True
for i in range(len(S)):
    if d[S[i]] == '' and d[T[i]] == '':
        d[S[i]] = T[i]
        d[T[i]] = S[i]
    elif d[S[i]] == T[i] and d[T[i]] == S[i]:
        pass
    else:
        flag = False
        break

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

Submission status: Wrong Answer

Solution code:
from collections import defaultdict

S = input()
T = input()

d = defaultdict(lambda: '')
flag = True
for i in range(len(S)):
    if d[S[i]] == '' and d[T[i]] == '':
        d[S[i]] = T[i]
        d[T[i]] = S[i]
    elif d[S[i]] == '' and d[T[i]] == S[i]:
        pass
    elif d[T[i]] == '' and d[S[i]] == T[i]:
        pass
    else:
        flag = False
        break

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

Submission status: Wrong Answer

Solution code:
from collections import defaultdict

S = input()
T = input()

d = defaultdict(lambda: '')
flag = True
for i in range(len(S)):
    if d[S[i]] == '' or d[T[i]] == '':
        d[S[i]] = T[i]
        d[T[i]] = S[i]
    elif d[S[i]] == T[i] and d[T[i]] == S[i]:
        pass
    else:
        flag = False
        break

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

Submission status: Wrong Answer

Solution code:
S = list(map(ord, list(input())))
T = list(map(ord, list(input())))
N = len(S)

dics = {}
for i in range(N):
    if T[i] not in dics.keys():
        dics[T[i]] = S[i]
    else:
        if dics[T[i]] != S[i]:
            print('No')
            break
else:
    print('Yes')

Submission status: Wrong Answer

Solution code:
def main():
    s = list(input())
    t = list(input())
    n = len(s)
    logs = {}

    for i in range(n):
        c1 = s[i]
        c2 = t[i]

        if c1 == c2:
            continue

        if c1 not in logs:
            logs[c1] = 1
        else:
            logs[c1] += 1

        if c2 not in logs:
            logs[c2] = 1
        else:
            logs[c2] += 1

    for c in logs.values():
        if c % 2 > 0:
            print('No')
            exit()
    print('Yes')


main()

Submission status: Wrong Answer

Solution code:
def main():
    s = list(input())
    t = list(input())
    n = len(s)

    for i in range(n):
        c1 = s[i]
        c2 = t[i]
        if c1 == c2:
            continue
        for j in range(n):
            if s[j] == c1:
                s[j] = c2
            elif s[j] == c2:
                s[j] = c1
        if s == t:
            print('Yes')
            exit()
    print('No')


main()

Submission status: Wrong Answer

Solution code:
def d(s,t):
    s1=list(set([i for i in s]))
    t1=list(set([i for i in t]))
    ans='No'
    st=list(set(s1+t1))
    #print(s1,t1,st)   
    #print(len(st),len(s1))
    if (len(st)-len(s1))%2!=0 or len(st)-len(s1)==0:
        ans='Yes'
    return ans
print(d(input(),input()))

Submission status: Wrong Answer

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

sd = {S[0]: 0}
td = {T[0]: 0}

def len_match():
    for i in range(1, len(S)):
        if (S[i-1] == S[i] and T[i-1] == T[i]) or (S[i] != S[i-1] and T[i] != T[i-1]):
            slast = sd.get(S[i], -1)
            tlast = td.get(T[i], -1)
            if slast != tlast:
                return False
            sd[S[i]] = slast
            td[T[i]] = tlast
        else:
            return False
    return True

def ans():
    result = len_match()
    return 'Yes' if result else 'No'

print(ans())

Submission status: Wrong Answer

Solution code:
from collections import Counter
s=Counter(list(input()))
t=Counter(list(input()))
s,t=list(s.values()),list(t.values())
print("Yes" if s.sort()==t.sort() else "No")

Submission status: Wrong Answer

Solution code:
from collections import Counter
s=Counter(list(input()))
t=Counter(list(input()))
s,t=list(s.values()),list(t.values())
print("Yes" if s.sort()==s.sort() else "No")

Submission status: Wrong Answer

Solution code:
from collections import Counter
s=Counter(list(input()))
t=Counter(list(input()))
s,t=list(s.values()),list(t.values())
print("Yes" if s==t else "No")

Submission status: Wrong Answer

Solution code:
S = list(input())
T = list(input())
s=[]
t=[]
ans = 'Yes'

for i in range(len(S)):
    if S[i] != T[i]:
        s.append(S[i])
        t.append(T[i])
    
u = [ s[i]+t[i] for i in range(len(s)) ]

if len(set(s)) != len(set(u)):
    ans = 'No'

if len(set(t)) != len(set(u)):
    ans = 'No'
    
print(ans)

Submission status: Wrong Answer

Solution code:
S = list(set(sorted(input())))
T = list(set(sorted(input())))
if(len(S) != len(T)):
  print('No')
  exit()
cnt = 0
for i in range(len(S)):
  if(S[i] != T[i]):
    cnt += 1
if(cnt <= 1):
  print('Yes')
else:
  print('No')

Submission status: Wrong Answer

Solution code:
S = sorted(input())
T = sorted(input())
cnt = 0
for i in range(len(S)):
  if(S[i] != T[i]):
    cnt += 1
if(cnt <= 1):
  print('Yes')
else:
  print('No')

Submission status: Wrong Answer

Solution code:
# A,B,C = [int(n) for n in input().split()]
# N = int(input())
S = list(input())
T = list(input())
same = "SAME"
s = set()
for i in range(len(S)):
    if not(S[i] in s):
        s.add(S[i])
        S[i] = i
    else:
        S[i] = same
s = set()
for i in range(len(T)):
    if not(T[i] in s):
        s.add(T[i])
        T[i] = i

    else:
        T[i] = same

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

Submission status: Wrong Answer

Solution code:
# A,B,C = [int(n) for n in input().split()]
# N = int(input())
S = list(input())
T = list(input())
same = "SAME"
s = set()
for i in range(len(S)):
    if not(S[i] in s):
        s.add(S[i])
        S[i] = i
    else:
        S[i] = same
s = set()
for i in range(len(T)):
    if not(T[i] in s):
        s.add(T[i])
        T[i] = i

    else:
        T[i] = same

print("YES" if T == S  else "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:
# coding: utf-8


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

    for ci in range(ord("a"), ord("z") + 1):
        c = chr(ci)
        ids = tuple((i for i in range(len(T)) if T[i] == c))
        if len(ids) < 2:
            continue
        cs = set((S[i] for i in ids))
        if len(cs) != 1:
            return False
    return True


if __name__ == "__main__":
    print(["No", "Yes"][main()])

Submission status: Wrong Answer

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

change = set()
ans = True
for i in range(0, len(s)):
    sc = s[i]
    tc = t[i]

    if sc != tc:
        if tc in change:
            ans = False
            break
        else:
            change.add(tc)
            s = s.replace(sc, "!").replace(tc, sc).replace("!", tc)

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

Submission status: Wrong Answer

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

fixed = set()
ans = True
for i in range(0, len(s)):
    sc = s[i]
    tc = t[i]

    if sc != tc:
        if tc in fixed:
            ans = False
            break
        else:
            s = s.replace(sc, "!")
            s = s.replace(tc, sc)
            s = s.replace("!", tc)
            fixed.add(tc)
    else:
        continue


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

Submission status: Wrong Answer

Solution code:
from collections import Counter

S = input()
T = input()

lenS = len(Counter(S))
lenT = len(Counter(T))

if lenS == lenT:
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

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

dic_S = {}
dic_T = {}

for i in range(len(S)):
	if S[i] == T[i]: continue
	else:
		if S[i] in dic_S.keys():
			if dic_S[S[i]] == T[i]: continue
			else:
				print('No')
				break
		if T[i] in dic_T.keys():
			if dic_T[T[i]] == S[i]: continue
			else:
				print('No')
				break
		else:
			dic_S[S[i]] = T[i]
			dic_T[T[i]] = S[i]
else:
	print('Yes')

Submission status: Wrong Answer

Solution code:
from operator import itemgetter
s = input()
t = input()
a = []
for i in range(len(s)-1):
  b = [s[i],t[i]]
  a.append(b)
a.sort()
for i in range(len(s)-2):
  if a[i][0] == a[i+1][0]:
    if a[i][1] != a[i+1][1]:
      print("No")
      exit()
a.sort(key=itemgetter(1))
for i in range(len(s)-2):
  if a[i][1] == a[i+1][1]:
    if a[i][0] != a[i+1][0]:
      print("No")
      exit()
print("Yes")

Submission status: Wrong Answer

Solution code:
from operator import itemgetter
s = input()
t = input()
a = []
for i in range(len(s)-1):
  b = [s[i],t[i]]
  a.append(b)
a.sort()
print(a)
for i in range(len(s)-2):
  if a[i][0] == a[i+1][0]:
    if a[i][1] != a[i+1][1]:
      print("No")
      exit()
a.sort(key=itemgetter(1))
for i in range(len(s)-2):
  if a[i][0] == a[i+1][0]:
    if a[i][1] != a[i+1][1]:
      print("No")
      exit()
print("Yes")

Submission status: Wrong Answer

Solution code:
from operator import itemgetter
s = input()
t = input()
a = []
for i in range(len(s)-1):
  b = [s[i],t[i]]
  a.append(b)
a.sort()
for i in range(len(s)-2):
  if (a[i][0] == a[i+1][0]) != (a[i][1] == a[i+1][1]):
    print("No")
    exit()
a.sort(key=itemgetter(1))
for i in range(len(s)-2):
  if (a[i][0] == a[i+1][0]) != (a[i][1] == a[i+1][1]):
    print("No")
    exit()
print("Yes")

Submission status: Wrong Answer

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

S.sort()
T.sort()

Sset = []
Tset = []

for i in range(len(S)):
    if S[i] not in Sset:    
        Sset.append(S[i])

    if T[i] not in Tset:
        Tset.append(T[i])


for char in Sset:
    if char in Tset:
        Sset.remove(char)
        Tset.remove(char)

if len(Tset) == len(Sset):
    ans = 'Yes' 
else:
    ans = 'No'

print(ans)

Submission status: Wrong Answer

Solution code:
S = input()
T = input()
al = [[] for i in range(26)]
for i in range(len(T)):
    index = ord(T[i]) - 97
    al[index].append(i)
for e in al:
    note = []
    for i in e:
        note.append(S[i])
    if len(list(set(note))) > 1:
        print("No")
        exit()
print("Yes")

Submission status: Wrong Answer

Solution code:
s = input()
t = input()
for i in range(len(s)-2):
  if (s[i] == s[i+1]) != (t[i] == t[i+1]):
    print("No")
    exit()
print("Yes")

Submission status: Wrong Answer

Solution code:
from collections import Counter

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

cs = sorted(Counter(S).values())
ct = sorted(Counter(T).values())

print(cs)
print(ct)

if cs == ct:
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

Solution code:
import numpy as np
S = str(input())
T = str(input())

S_and_T = list(set(S) & set(T))
#S_T = list(set(S)-set(S_and_T))
#T_S = list(set(T)-set(S_and_T))
if len(S) != len(T):
    print("NO")

elif len(S_and_T) == 0:
    print("YES")
    exit()

elif len(set(S)) != len(set(T)):
    print("NO")

else:
    print("YES")

Submission status: Wrong Answer

Solution code:
import string
import numpy as np
s = input()
t = input()
a = np.zeros(26)
b = np.zeros(26)
str2 = string.ascii_letters
for i in range(0,26):
 a[i] = s.find(str2[i]) 
 b[i] = t.find(str2[i])
c = sorted(a)
d = sorted(b)
if c == d :
 print('Yes')
else:
 print ('No')

Submission status: Wrong Answer

Solution code:
S=input()
T=input()
table=[-1 for i in range(26)]
c=0
for i in range(len(S)):
    A=ord(S[i])-ord('a')
    B=ord(T[i])-ord('a')
    if table[A]==-1:
        table[B]=A
    elif table[A]!=-1:
        if table[B]!=A:
            c=1
            break
if c==0:
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

Solution code:
S=input()
T=input()
table=[-1 for i in range(26)]
c=0
for i in range(len(S)):
    A=ord(S[i])-ord('a')
    B=ord(T[i])-ord('a')
    if table[A]==-1 and table[B]==-1:
        table[A]=B
        table[B]=A
    elif table[A]!=-1 or table[B]!=-1 :
        if table[A]!=B or table[B]!=A:
            c=1
            break

    else:
        continue
if c==0:
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

Solution code:
S=input()
T=input()
table=[-1 for i in range(27)]
c=0
for i in range(len(S)):
    A=ord(S[i])-ord('a')
    B=ord(T[i])-ord('a')
    if table[B]==-1:
        table[B]=A
    elif table[B]!=-1:
        if table[B]!=A:
            c=1
            break
if c==0:
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

Solution code:
S=input()
T=input()
table=[-1 for i in range(26)]
c=0
for i in range(len(S)):
    A=ord(S[i])-ord('a')
    B=ord(T[i])-ord('a')
    if table[B]==-1:
        table[B]=A
    elif table[B]!=-1:
        if table[B]!=A:
            c=1
            break
    else:
        continue
if c==0:
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

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


def answer(S, T, N):
    # print(S)
    # print(T)
    same_c1_list = []
    same_c1 = []
    i = 0
    while i < N:
        c1 = S[i]
        c2 = T[i]
        # same_c1.append(c1, c2)
        # j = i + 1
        # while j < N:
        #     if S[j] == c1:
        #         same_c1.append(S[j], T[j])

        for j in range(i, N):
            if S[j] == c1:
                same_c1.append([S[j], T[j]])
            else:
                same_c1_list.append(same_c1)
                break
        if j == N - 1:
            break
        i = j
        same_c1 = []
        # print([i, j])

    for same_c1 in same_c1_list:
        c2 = same_c1[0][1]
        for c1c2 in same_c1:
            if c1c2[1] != c2:
                return False

    # i = 0
    # while i < N:
    #     c1 = S[i]
    #     c2 = T[i]
    #     # print("c1:", str(c1))
    #     # print("c2:", str(c2))
    #     if c1 != c2:
    #         for j in range(N):
    #             # print([S[j], c1])
    #             # print([T[j], c2])
    #             if S[j] == c1 and T[j] != c2:
    #                 return False
    #     i += 1

    return True


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

N = len(S)

ST = [None] * N

for i in range(N):
    ST[i] = [S[i], T[i]]

ST.sort(key=lambda a_i: a_i[0])

for i in range(N):
    S[i] = ST[i][0]
    T[i] = ST[i][1]

ans1 = answer(S, T, N)

ST.sort(key=lambda a_i: a_i[1])

for i in range(N):
    S[i] = ST[i][0]
    T[i] = ST[i][1]

# print(S)
# print(T)

ans2 = answer(T, S, N)

if ans1 and ans2:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

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

S = input()
T = input()

N = len(S)

ST = [None] * N

for i in range(N):
    ST[i] = [S[i], T[i]]

ST.sort(key=lambda a_i: a_i[0])

# for st in ST:
#     print(st)

dic = {}
for i, st in enumerate(ST):
    if st[0] in dic.keys():
        if i < dic[st[0]]:
            dic[st[0]] = i
    else:
        dic[st[0]] = i

i = 0
while i < N:
    ST_copy = ST
    dic_copy = dic
    if ST[i][0] != ST[i][1]:
        for j in range(i, N):
            if ST[j][0] != ST[i][0]:
                break
            ST_copy[j][0] = ST[i][1]
            if ST[i][1] in dic_copy.keys():
                if j < dic_copy[ST[i][1]]:
                    dic_copy[ST[i][1]] = j
            else:
                dic_copy[ST[i][1]] = j
        if ST[i][0] in dic_copy.keys():
            del dic_copy[ST[i][0]]
        if ST[i][1] in dic.keys():
            k = dic[ST[i][1]]
            while k < N:
                if ST[k][0] != ST[i][1]:
                    break
                ST_copy[k][0] = ST[i][0]
                if ST[i][0] in dic_copy.keys():
                    if k < dic_copy[ST[i][0]]:
                        dic_copy[ST[i][0]] = k
                else:
                    dic_copy[ST[i][0]] = k
                k += 1
            if ST[i][1] in dic_copy.keys():
                del dic_copy[ST[i][1]]
    ST = ST_copy
    dic = dic_copy
    i += 1

# for st in ST:
#     print(st)

equal = True
for st in ST:
    if st[0] != st[1]:
        equal = False
        break

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

Submission status: Wrong Answer

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

S = input()
T = input()

N = len(S)

ST = [None] * N

for i in range(N):
    ST[i] = [S[i], T[i]]

ST.sort(key=lambda a_i: a_i[0])

# for st in ST:
#     print(st)

dic = {}
for i, st in enumerate(ST):
    if st[0] in dic.keys():
        if i < dic[st[0]]:
            dic[st[0]] = i
    else:
        dic[st[0]] = i

i = 0
while i < N:
    ST_copy = ST
    dic_copy = dic
    if ST[i][0] != ST[i][1]:
        for j in range(i, N):
            if ST[j][0] != ST[i][0]:
                break
            ST_copy[j][0] = ST[i][1]
            if ST[i][1] in dic_copy.keys():
                if j < dic_copy[ST[i][1]]:
                    dic_copy[ST[i][1]] = j
            else:
                dic_copy[ST[i][1]] = j
        if ST[i][0] in dic_copy.keys():
            del dic_copy[ST[i][0]]
        if ST[i][1] in dic.keys():
            k = dic[ST[i][1]]
            while k < N:
                if ST[k][0] != ST[i][1]:
                    break
                ST_copy[k][0] = ST[i][0]
                if ST[i][0] in dic_copy.keys():
                    if k < dic_copy[ST[i][0]]:
                        dic_copy[ST[i][0]] = k
                else:
                    dic_copy[ST[i][0]] = k
                k += 1
            if ST[i][1] in dic_copy.keys():
                del dic_copy[ST[i][1]]
    ST = ST_copy
    dic = dic_copy
    i += 1

for st in ST:
    print(st)

equal = True
for st in ST:
    if st[0] != st[1]:
        equal = False
        break

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

Submission status: Wrong Answer

Solution code:
s = input()
t = input()
done_salp = []
done_talp = []
dic1 = {}
dic2 = {}
for i in range(len(s)):
    if t[i] in done_talp:
        print("No")
        exit()

    if dic1.get(s[i]) == None and dic2.get(t[i]) == None:
        dic1[s[i]] = t[i]
        dic2[t[i]] = s[i]
        done_salp.append(s[i])
        done_talp.append(t[i])
        continue
    if dic1[s[i]] != t[i] or dic2[t[i]] != s[i]:
        print("No")
        exit()
print("Yes")

Submission status: Wrong Answer

Solution code:
S = list(input())
T = list(input())
n = len(S)
dic = {}

for s,t in zip(S,T):
    if s in dic:
        dic[s].add(t)
    else:
        dic[s] = set([t])

    if t in dic:
        dic[t].add(s)
    else:
        dic[t] = set([s])

for key in dic.keys():
    sz = len(dic[key])
    for node in dic[key]:
        if sz != len(dic[node]):
            print("No")
            exit(0)

print("Yes")

Submission status: Wrong Answer

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

if len(S) != len(T):
    print("No")
    exit(0)

dic = {}
for s,t in zip(S,T):
    if s in dic:
        dic[s].add(t)
    else:
        dic[s] = set([t])

for key in dic.keys():
    if len(dic[key]) >= 2:
        print("No")
        exit(0)

print("Yes")

Submission status: Wrong Answer

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

if len(S) != len(T):
    print("No")
    exit(0)

dic = {}
for s,t in zip(S,T):
    if t in dic:
        dic[t].add(s)
    else:
        dic[t] = set([s])

for key in dic.keys():
    if len(dic[key]) >= 2:
        print("No")
        exit(0)

print("Yes")

Submission status: Wrong Answer

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

if len(S) != len(T):
    print("No")
    exit(0)

dic = {}
for s,t in zip(S,T):
    if s in dic:
        dic[s].add(t)
    else:
        dic[s] = set([t])

    if t in dic:
        dic[t].add(s)
    else:
        dic[t] = set([s])

for key in dic.keys():
    if len(dic[key]) >= 2:
        print("No")
        exit(0)

print("Yes")

Submission status: Wrong Answer

Solution code:
import numpy as np
import string

S = input()
T = input()

S_ = []
T_ = []
for c in string.ascii_lowercase:
    S_.append(np.array(list(map(lambda x: 0 if c != x else 1, S))))
    T_.append(np.array(list(map(lambda x: 0 if c != x else 1, T))))

for s_ in S_:
    flag = False
    for t_ in T_:
        if np.min(t_- s_) >= 0:
            flag = True
            break
    if not flag:
        print("No")
        exit(0)

print("Yes")

Submission status: Wrong Answer

Solution code:
S = input()
T = input()
 
dic = {}
 
 
def solve():
    for t,s in zip(S, T):
        if t in dic.keys():
            if s != dic[t]:
                print('No')
                return
        else:
            dic[t] = s
    print('Yes')
    return
 
 
solve()

Submission status: Wrong Answer

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

dic = {}


def solve():
    for s, t in zip(S, T):
        if t in dic.keys():
            if s != dic[t]:
                print('No')
                return
        else:
            dic[t] = s
    print('Yes')
    return


solve()

Submission status: Wrong Answer

Solution code:
import sys
from itertools import combinations
S = input()
T = input()

# Tに含まれないSの文字は自由に置き換えられる
diff = set(S) - set(T)
replacedby = set()
for c1 in diff:
    c2 = T[S.index(c1)]
    replacedby.add(c2)
    S = S.replace(c1, c2)
# 共通の文字でありかつ一致しない場合はスワップする必要がある
# よってそのような文字が偶数個であればSはTにできる
not_same = {s for s, t in zip(S, T) if s != t}
# ただし置き換えた文字が一致しない文字に含まれる場合はSはTにできない
if not_same & replacedby:
    print('No')
    sys.exit()
cup = set(S) & set(T) & not_same
if len(cup) % 2 == 0:
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

Solution code:
from collections import Counter

s=input()
t=input()
if len(Counter(t))==len(Counter(s)) and len(s)==len(t):
  print("Yes")
else:
  print("No")

Submission status: Wrong Answer

Solution code:
from collections import Counter

s=input()
t=input()
if len(Counter(t))==len(Counter(s)):
  print("Yes")
else:
  print("No")

Submission status: Wrong Answer

Solution code:
# coding: utf8

if __name__ == "__main__":
    s = input()
    t = input()
    map_s = {}
    map_t = {}
    if len(s) != len(t):
        print("No")
    for i in range(len(s)):
        if s[i] not in map_s:
            map_s[s[i]] = t[i]
        else:
            if map_s[s[i]] != t[i]:
                print("No")
                break
        if t[i] not in map_t:
            map_t[t[i]] = s[i]
        else:
            if map_t[t[i]] != s[i]:
                print("No")
                break
    if i == len(s) - 1:
        print("Yes")

Submission status: Wrong Answer

Solution code:
S = list(input())
T = list(input())
alp = [chr(ord('a') + i) for i in range(26)]
al = [-1 for i in range(26)]
for i in range(len(S)):
    if S[i] != T[i]:
        if al[alp.index(S[i])] == -1 and al[alp.index(T[i])] == -1:
            al[alp.index(S[i])] = alp.index(T[i])
            al[alp.index(T[i])] = alp.index(S[i])
        else:
            if al[alp.index(S[i])] != alp.index(T[i]) or al[alp.index(T[i])] != alp.index(S[i]):
                print("No")
                quit()
print("Yes")

Submission status: Wrong Answer

Solution code:
S = list(input())
T = list(input())
alp = [chr(ord('a') + i) for i in range(26)]
al = [-1 for i in range(26)]
for i in range(len(S)):
    if S[i] != T[i]:
        if al[alp.index(S[i])] == -1 and al[alp.index(T[i])] == -1:
            al[alp.index(S[i])] == alp.index(T[i])
            al[alp.index(T[i])] == alp.index(S[i])
        else:
            if al[alp.index(S[i])] != alp.index(T[i]) or al[alp.index(T[i])] != alp.index(S[i]):
                print("No")
                quit()
print("Yes")

Submission status: Wrong Answer

Solution code:
S = list(input())
T = list(input())
alp = [chr(ord('a') + i) for i in range(26)]
al = [-1 for i in range(26)]
for i in range(len(S)):
    if S[i] != T[i]:
        if al[alp.index(S[i])] == -1 and al[alp.index(T[i])] == -1:
            al[alp.index(S[i])] == alp.index(T[i])
            al[alp.index(T[i])] == alp.index(S[i])
        elif al[alp.index(S[i])] == -1 and al[alp.index(T[i])] != -1:
            al[alp.index(S[i])] == alp.index(T[i])
        elif al[alp.index(S[i])] != -1 and al[alp.index(T[i])] == -1:
            al[alp.index(T[i])] == alp.index(S[i])
        else:
            if al[alp.index(S[i])] == alp.index(T[i]) and al[alp.index(T[i])] == alp.index(S[i]):
                continue
            else:
                print("No")
                quit()
print("Yes")

Submission status: Wrong Answer

Solution code:
S = list(input())
T = list(input())
alp = [chr(ord('a') + i) for i in range(26)]
al = [-1 for i in range(26)]
for i in range(len(S)):
    if S[i] != T[i]:
        if al[alp.index(S[i])] == -1 and al[alp.index(T[i])] == -1:
            al[alp.index(S[i])] = alp.index(T[i])
            al[alp.index(T[i])] = alp.index(S[i])
        else:
            if al[alp.index(S[i])] == alp.index(T[i]) and al[alp.index(T[i])] == alp.index(S[i]):   
                continue
            else:
                print("No")
                quit()
print("Yes")

Submission status: Wrong Answer

Solution code:
S = list(input())
T = list(input())
alp = [chr(ord('a') + i) for i in range(26)]
al = [-1 for i in range(26)]
for i in range(len(S)):
    if S[i] != T[i]:
        if al[alp.index(S[i]) - 1] == -1 and al[alp.index(T[i]) - 1] == -1:
            al[alp.index(S[i]) - 1] = alp.index(T[i]) - 1
            al[alp.index(T[i]) - 1] = alp.index(S[i]) - 1
        else:
            if al[alp.index(S[i]) - 1] == alp.index(T[i]) - 1 and al[alp.index(T[i]) - 1] == alp.index(S[i]) - 1:
                continue
            else:
                print("No")
                quit()
print("Yes")

Submission status: Wrong Answer

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

sd = {}
td = {}

for k in range(ord('a'),ord('z')+1):   
    sd[chr(k)] = 0
    td[chr(k)] = 0

for i in range(len(s)) :
    if s[i] in sd :
        sd[s[i]] = sd[s[i]] + 1

    if t[i] in td :
        td[t[i]] = td[t[i]] + 1
""" 
for k in range(ord('a'),ord('z')+1):   
    print(str(chr(k)) + ":",end="")
    if chr(k) in sd :
        print(str(sd[chr(k)]) + " ",end="")
    else:
        print("0 ",end="")
print()
for k in range(ord('a'),ord('z')+1):   
    print(str(chr(k)) + ":",end="")
    if chr(k) in td :
        print(str(td[chr(k)]) + " ",end="")
    else:
        print("0 ",end="")
print() """

ta = []
sa = []
for k in range(ord('a'),ord('z')+1):
    if td[chr(k)] != sd[chr(k)] : 
        if td[chr(k)] > 0 :
            ta.append(td[chr(k)])
        if sd[chr(k)] > 0 :    
            sa.append(sd[chr(k)])
#print(ta)
#print(sa)

if ta == sa :
    print("Yes")
else :
    print("No")

Submission status: Wrong Answer

Solution code:
s  = list(str(input()))
t  = list(str(input()))
s.sort()
t.sort()

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

Submission status: Wrong Answer

Solution code:
s  = list(str(input()))
t  = list(str(input()))
s.sort()
t.sort()

for i in range(len(s)):

    if s == t :
        print("Yes")
        exit(0)
 
    if s[i] != t[i]:
 
        c1 = s[i]
        c2 = t[i]

        for j in range(len(s)):
            if s[j] == c1:
                s[j] = c2
            elif s[j] == c2:
                s[j] = c1

print("No")

Submission status: Wrong Answer

Solution code:
ss  = str(input())
tt  = str(input())
s   = list(ss)
t   = list(tt)
s.sort()
t.sort()

for i in range(len(s)):

    ss = "".join(s) 
    tt = "".join(t) 

    if ss == tt :
        print("Yes")
        exit(0)
 
    if s[i] != t[i]:
 
        c1 = s[i]
        c2 = t[i]

        for j in range(len(s)):
            if s[j] == c1:
                s[j] = c2
            elif s[j] == c2:
                s[j] = c1
print("No")

Submission status: Wrong Answer

Solution code:
ss  = str(input())
tt  = str(input())
s   = list(ss)
t   = list(tt)
s.sort()
t.sort()

for i in range(len(s)):

    ss = "".join(s) 
    tt = "".join(t) 

    if ss == tt :
        print("Yes")
        exit(0)
 
    if s[i] != t[i]:
 
        c1 = s[i]
        c2 = t[i]

        for j in range(i,len(s)):
            if s[j] == c1:
                s[j] = c2
            elif s[j] == c2:
                s[j] = c1
print("No")

Submission status: Wrong Answer

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

for i in range(len(s)):

    if ss == t :
        print("Yes")
        exit(0)

    if s[i] != t[i]:

        c1 = s[i]
        c2 = t[i]
        for j in range(i,len(s)):
            if s[j] == c1:
                s[j] = c2
            elif s[j] == c2:
                s[j] = c1
            #print(j,"")         
        #print()
        ss = "".join(s)
        #print(ss)
print("No")

Submission status: Wrong Answer

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

r = []

for i in range(len(s)):

    if ss == t :
        print("Yes")
        exit(0)

    if s[i] != t[i]:
        c1 = s[i]
        c2 = t[i]

        r.append(c1)

        for j in range(i,len(s)):
            if s[j] == c1:
                s[j] = c2
            elif s[j] == c2:
                s[j] = c1        
        
        ss = "".join(s)
print("No")