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 = input()
t = input()

def checking(check_dict, key, val, yes_ans):
    if key in check_dict:
        if check_dict[key] == val:
            pass
        else:
            print('No')
            yes_ans = False
            return yes_ans
    else:
        check_dict[key] = val
    return yes_ans


t_dict = {}
s_dict = {}
yes_ans = True

for t_val, s_val in zip(t, s):
    yes_ans = checking(t_dict, t_val, s_val, yes_ans)
    yes_ans = checking(s_dict, s_val, t_val, yes_ans)
    if yes_ans == False:
        break

if yes_ans:
    print('Yes')

Submission status: Wrong Answer

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

check_dict = {}
yes_ans = True
for key, val in zip(t, s):
    if key in check_dict:
        if check_dict[key] == val:
            continue
        else:
            print('No')
            yes_ans = False
            break
    else:
        check_dict[key] = val

if yes_ans:
    print('Yes')

Submission status: Wrong Answer

Solution code:
s=str(input())
t=str(input())
dic={}
lis=[]
lit=[]
for i in range(len(s)):
    if s[i] in lis:
        if t[i] in lit:
            if dic[t[i]]!=s[i] or dic[s[i]]!=t[i]:
                print("No")
                break
        else:
            if dic[s[i]]!=t[i]:
                print("No")
                break
            else:
                dic.update([(t[i],s[i])])
                lit.append(t[i])                    
    elif t[i] in lit:
        if dic[t[i]]!=s[i]:
            print("No")
            break 
        else:
            dic.update([(s[i],t[i])])
            lis.append(s[i])                                    
    else:
        dic.update([(s[i],t[i])])
        dic.update([(t[i],s[i])])
        lis.append(s[i]) 
        lit.append(t[i])
                
    if i==len(s)-1:
        print("Yes")

Submission status: Wrong Answer

Solution code:
s=str(input())
t=str(input())
dic={}
lis=[]
lit=[]
for i in range(len(s)):
    if s[i] in lis:
        if t[i] in lit:
            if dic[t[i]]!=s[i]:
                print("No")
                break
            elif dic[s[i]]!=t[i]:
                print("No")
                break    
        else:
            if dic[s[i]]!=t[i]:
                print("No")
                break
            else:
                dic.update([(t[i],s[i])])
                lit.append(t[i])                    
    elif t[i] in lit:
        if dic[t[i]]!=s[i]:
            print("No")
            break 
        else:
            dic.update([(s[i],t[i])])
            lis.append(s[i])                                    
    else:
        dic.update([(s[i],t[i])])
        dic.update([(t[i],s[i])])
        lis.append(s[i]) 
        lit.append(t[i])
                
    if i ==len(s)-1:
        print("Yes")

Submission status: Wrong Answer

Solution code:
s=str(input())
t=str(input())
dic={}
lis=[]
lit=[]
for i in range(len(s)):
    if s[i] in lis:
        if t[i] in lit:
            if dic[t[i]]!=s[i]:
                print("No")
                break
            elif dic[s[i]]!=t[i]:
                print("No")
                break    
        else:
            if dic[s[i]]!=t[i]:
                print("No")
                break
    elif t[i] in lit:
        if dic[t[i]]!=s[i]:
            print("No")
            break                    
    else:
        dic.update([(s[i],t[i])])
        dic.update([(t[i],s[i])])
        lis.append(s[i]) 
        lit.append(t[i])
                
    if i ==len(s)-1:
        print("Yes")

Submission status: Wrong Answer

Solution code:
s=str(input())
t=str(input())
dic={}
lis=[]
lit=[]
for i in range(len(s)):
    if s[i] in lis:
        if t[i] in lit:
            if dic[t[i]]!=s[i]:
                print("No")
                break
        else:
            if dic[s[i]]!=t[i]:
                print("No")
                break
    elif t[i] in lit:
        if dic[t[i]]!=s[i]:
            print("No")
            break                    
    else:
        dic.update([(s[i],t[i])])
        dic.update([(t[i],s[i])])
        lis.append(s[i]) 
        lit.append(t[i])
                
    if i ==len(s)-1:
        print("Yes")

Submission status: Wrong Answer

Solution code:
s=str(input())
t=str(input())
dic={}
lis=[]

for i in range(len(s)):
    if s[i]!=t[i] and s[i] in lis:
        if dic[s[i]]!=t[i]:
            print("No")
            break
    elif s[i]!=t[i] and t[i] in lis:
        if dic[t[i]]!=s[i]:
            print("No")
            break
    elif s[i]!=t[i]:
        dic.update([(s[i],t[i])])
        lis.append(s[i]) 
    if i ==len(s)-1:
        print("Yes")

Submission status: Wrong Answer

Solution code:
s=str(input())
t=str(input())
dic={}
dict={}
lis=[]
lit=[]

for i in range(len(s)):
    if s[i]!=t[i] and s[i] in lis:
        if dic[s[i]]!=t[i]:
            print("No")
            break
    elif s[i]!=t[i] and t[i] in lit:
        if dict[t[i]]!=s[i]:
            print("No")
            break
    elif s[i]!=t[i]:
        dic.update([(s[i],t[i])])
        lis.append(s[i]) 
        dict.update([(t[i],s[i])]) 
        lit.append(t[i])  
    if i ==len(s)-1:
        print("Yes")

Submission status: Wrong Answer

Solution code:
s=str(input())
t=str(input())
dic={}
li=[]
for i in range(len(s)):
    if s[i]!=t[i] and t[i] in li:
        if dic[t[i]]!=s[i]:
            print("No")
            break
    elif s[i]!=t[i]:
        if i==len(s)-1:
            print("Yes")
        else:
            dic.update([(t[i],s[i])])
            li.append(t[i])    
    else:
      if i==len(s)-1:
        print("Yes")

Submission status: Wrong Answer

Solution code:
s=str(input())
t=str(input())
dic={}
li=[]
for i in range(len(s)):
    if s[i]!=t[i] and t[i] in li:
        if dic[t[i]]!=s[i]:
            print("No")
            break
    elif s[i]!=t[i]:
        if i==len(s)-1:
            print("Yes")
        else:
            dic.update([(t[i],s[i])])
            li.append(t[i])

Submission status: Wrong Answer

Solution code:
s = input()
t = input()
l = []
if len(set(s)) != len(set(t)):
  print("No")
  exit()
for i in range(len(s)):
  if s[i] == t[i]:
    l.append(t[i])
for i in range(len(s)):
  if s[i] != t[i] and t[i] in l:
    print("No")
    exit()
print("Yes")

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
a=input()
b=input()
c={}
state=True
for i in range(len(a)):
  if b[i] not in c:
    c[b[i]]=a[i]
  if b[i] in c:
    if c[b[i]]!=a[i]:
      state=False
  else:
    state=False
if state:
  print('Yes')
else:
  print('No')

Submission status: Wrong Answer

Solution code:
a=input()
b=input()
c={}
state=True
for i in range(len(a)):
  if b[i] not in c:
    c[b[i]]=a[i]
  if c[b[i]]!=a[i]:
    state=False
if state:
  print('Yes')
else:
  print('No')

Submission status: Wrong Answer

Solution code:
a=input()
b=input()
c={}
state=True
for i in range(len(a)):
  if b[i] not in c:
    c[b[i]]=a[i]
    c[a[i]]=b[i]
  if c[b[i]]!=a[i]:
    state=False
if state:
  print('Yes')
else:
  print('No')

Submission status: Wrong Answer

Solution code:
l=list(input())
m=list(input())
def list_difference(list1, list2):
	result = list1.copy()
	for value in list2:
		if value in result:
			result.remove(value)
	return result
aa=list_difference(l,m)
bb=list_difference(m,l)
print(["No","Yes"][len(aa)==len(bb)])

Submission status: Wrong Answer

Solution code:
l=input()
m=input()
ll=set(l)-set(m)
lll=set(m)-set(l)
print(["No","Yes"][len(ll)==len(lll)])

Submission status: Wrong Answer

Solution code:
S=str(input())
T=str(input())
hantei= True
t_S=[]
t_T=[]
for i in range(len(S)):
  t_S += [S[i]+T[i]]
  t_T += [T[i]+S[i]]
t_S.sort()
t_T.sort()
for i in range(len(S)-1):
  if t_S[i][0]==t_S[i+1][0] and t_S[i][1]==t_S[i+1][1]:
    hantei = False
  if t_T[i][0]==t_T[i+1][0] and t_T[i][1]==t_T[i+1][1]:
    hantei = False
print('Yes' if hantei else 'No')

Submission status: Wrong Answer

Solution code:
x = input()
y = input()


for i in range(97,123):
    if chr(i) not in x or chr(i) not in y:
        continue
    li = []
    li_2 = []
    for j in range(len(x)):
        if chr(i) == x[j]:
            li.append(y[j])
        elif chr(i) == y[j]:
            li_2.append(x[j])
        if len(li) >= 2:
            if len(list(set(li))) == 1:
                continue
            else:
                print('No')
                exit()
        elif len(li_2) >= 2:
            if len(list(set(li_2))) == 1:
                continue
            else:
                print('No')
                exit()

print('Yes')

Submission status: Wrong Answer

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

from collections import defaultdict as dd
s = dd(list)
t = dd(list)

for i in range(len(S)):
    s[S[i]].append(i)
for i in range(len(T)):
    t[T[i]].append(i)

for (sk, sv), (tk, tv) in zip(s.items(), t.items()):
    if sv != tv:
        print('No')
        exit()
print('Yes')

Submission status: Wrong Answer

Solution code:
import sys
from collections import Counter 
input = sys.stdin.readline
s = list(input())
del s[-1]
t = list(input())
del t[-1]
s_c = Counter(s)
t_c = Counter(t)

already_counted = []

for i in range(len(s)):
    if not s[i] in already_counted:
        if t[i] in s_c:
            if s_c[s[i]] != s_c[s[i]]:
                print("No")
                exit()
    already_counted.append(s[i])
    already_counted.append(t[i])

already_counted = []

for i in range(len(t)):
    if not t[i] in already_counted:
        if s[i] in t_c:
            if t_c[t[i]] != t_c[s[i]]:
                print("No")
                exit()
    already_counted.append(t[i])
    already_counted.append(s[i])

print("Yes")

Submission status: Wrong Answer

Solution code:
# 1対1なので決めていく
s, t = input(), input()
# ぜんぶ違ってればたぶんいける
if len(set(list(s))) == len(set(list(t))):
    print("Yes")
    exit()
table = {}
flag = True
for i in range(len(s)):
    if s[i] not in table and t[i] not in table:
        table[s[i]] = t[i]
        table[t[i]] = s[i]
    else:
        if (
            s[i] not in table
            or t[i] not in table
            or table[s[i]] != t[i]
            or table[t[i]] != s[i]
        ):
            flag = False
print("Yes" if flag else "No")

Submission status: Wrong Answer

Solution code:
# 1対1なので決めていく
s, t = input(), input()
# ぜんぶ違ってればたぶんいける
if len(set(list(s))) == len(set(list(t))):
    print("Yes")
    exit()
table = {}
flag = True
for i in range(len(s)):
    if s[i] not in table and t[i] not in table:
        table[s[i]] = t[i]
        table[t[i]] = s[i]
    else:
        if s[i] not in table or t[i] not in table or table[s[i]] != table[t[i]]:
            flag = False
print("Yes" if flag else "No")

Submission status: Wrong Answer

Solution code:
d={}
w1=input()
w2=input()
num=len(w1)
b=True
for i in list("qwertyuiopasdfghjklzxcvbnm"):
  d[i]=""
for i in range(num):
  if d[w1[i]]=="":
    d[w1[i]]=w2[i]
  elif d[w1[i]]==w2[i]:
    pass
  elif d[w1[i]]!=w2[i]:
    b=False
    break
if b:
  print("No")
else:
  l=[]
  for i in d:
    if d[i] in l:
      b=False
      break
    else:
      if d[i]!="":
        l.append(d[i])
  if b:
    print("Yes")
  else:
    print("No")

Submission status: Wrong Answer

Solution code:
S = list(input())
T = list(input())
now = 0
same_idx = []
for i in range(len(S)):
    if S[i] == T[i]:
        same_idx.append(S[i])

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

Submission status: Wrong Answer

Solution code:
from collections import Counter
S = list(input())
T = list(input())
now = 0
same_idx = []
for i in range(len(S)):
    if S[i] == T[i]:
        same_idx.append(S[i])
S = Counter(S)
T = Counter(T)

for c in same_idx:
    if S[c] != T[c]:
        print("No")
        exit()
print("Yes")

Submission status: Wrong Answer

Solution code:
import sys
from collections import defaultdict
input = sys.stdin.readline

S = input().strip()
T = input().strip()

dic = defaultdict(list)

def check(d):
    for k, i in d.items():
        if k != i:
            return False
    else:
        return True

for s, t in zip(S, T):
    if t not in dic[s]:
        dic[s].append(t)

for k, i in dic.items():
    if len(i) > 1:
        print('No')
        exit()
    else:
        dic[k] = i[0]

c = 0
while c <= 100:
    for k, i in dic.items():
        if i not in dic:
            dic[i] = i
            del dic[k]
        else:
            dic[k], dic[i] = k, i
    c += 1

if check(dic):
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

Solution code:
import sys
from collections import defaultdict
input = sys.stdin.readline

S = input().strip()
T = input().strip()
dic = defaultdict(list)

def check(d):
    for k, i in d.items():
        if k != i:
            return False
    else:
        return True

for s, t in zip(S, T):
    if t not in dic[s]:
        dic[s].append(t)

for k, i in dic.items():
    if len(i) > 1:
        print('No')
        exit()
    else:
        dic[k] = i[0]

for k, i in dic.items():
    if i not in dic:
        dic[i] = i
        del dic[k]
    else:
        dic[k], dic[i] = k, i
if check(dic):
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

Solution code:
S=input()
T=input()
dicS={}
dicT={}
for i in range(len(S)):
  if S[i]!=T[i]:
    if S[i] not in dicS:
      dicS[S[i]]=T[i]
    if T[i] not in dicT:
      dicT[T[i]]=S[i]
    else:
      if dicS[S[i]]!=T[i]:
        print("No")
        break
      if dicT[T[i]]!=S[i]:
        print("No")
        break
else:
  print("Yes")

Submission status: Wrong Answer

Solution code:
import numpy as np


def solve(s, t):
    u = np.array([0]*26)
    v = np.array([0]*26)

    for si in s:
        u[ord(si)-97] += 1
    for ti in t:
        v[ord(ti)-97] += 1
    w = u-v
    w.sort()
    for i in range(26):
        if w[i] + w[25-i] != 0:
            return False

    return True


if __name__ == '__main__':
    s = input()
    t = input()
    ans = 'Yes' if solve(s, t)else 'No'
    print(ans)

Submission status: Wrong Answer

Solution code:
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy,copy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd

def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

def main():
    s = list(input())
    t = list(input())
    n = len(s)
    s.sort()
    t.sort()
    s_dict = defaultdict(int)
    t_dict = defaultdict(int)
    for i in range(n):
        s_dict[s[i]] += 1
        t_dict[t[i]] += 1

    #print(list(s_dict.values()))
    #print(list(t_dict.values()))

    if list(s_dict.values()) == list(t_dict.values()):
        print('Yes')
    else:
        print('No')
        

if  __name__=='__main__':
    main()

Submission status: Wrong Answer

Solution code:
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy,copy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd

def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

def main():
    s = list(input())
    t = list(input())
    n = len(s)
    s.sort()
    t.sort()
    s_dict = {}
    t_dict = {}
    for i in range(n):
        s_dict.setdefault(s[i])
        t_dict.setdefault(t[i])
        if s_dict[s[i]] == None:
            s_dict[s[i]] = 1
        else:
            s_dict[s[i]] += 1

        if t_dict[t[i]] == None:
            t_dict[t[i]] = 1
        else:
            t_dict[t[i]] += 1

    #print(list(s_dict.values()))
    #print(list(t_dict.values()))

    if list(s_dict.values()) == list(t_dict.values()):
        print('Yes')
    else:
        print('No')
        

if  __name__=='__main__':
    main()

Submission status: Wrong Answer

Solution code:
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy,copy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd

def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

def main():
    s = input()
    t = input()
    s_set = set(s)
    t_set = set(t)
    if len(s_set) == len(t_set):
        print('Yes')
    else:
        print('No')

if  __name__=='__main__':
    main()

Submission status: Wrong Answer

Solution code:
w="qwertyuiopasdfghjklzxcvbnm"
l1=sorted(list(w))
d={}
for i in range(26):
  d[l1[i]]=""
w1=input()
w2=input()
num=len(w1)
b=True
for i in range(num):
  if w1[i]==w2[i]:
    d[w1[i]]=w2[i]
  else:
    if d[w1[i]]=="":
      d[w1[i]]==w2[i]
    elif d[w1[i]]!=w2[i]:
      b=False
if b:
  print("Yes")
else:
  print("No")

Submission status: Wrong Answer

Solution code:
w="qwertyuiopasdfghjklzxcvbnm"
l1=sorted(list(w))
d={}
for i in range(26):
  d[l1[i]]=""
w1=input()
w2=input()
num=len(w1)
b=True
for i in range(num):
  if w1[i]==w2[i]:
    pass
  else:
    if d[w1[i]]=="":
      d[w1[i]]==w2[i]
    elif d[w1[i]]!=w2[i]:
      b=False
if b:
  print("Yes")
else:
  print("No")

Submission status: Wrong Answer

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

s.sort()
t.sort()

slist=[]
tlist=[]
#sとtそれぞれ、a～zがそれぞれ何個ずつあるか記録した配列。

for i in range(26):
  c=chr(i+ord("a"))
  temp1=s.count(c)
  temp2=t.count(c)
  if temp1!=0:
    slist.append(temp1)
  if temp2!=0:
    tlist.append(temp2)

slist.sort
tlist.sort

if slist==tlist:
  print("Yes")
else:
  print("No")

Submission status: Wrong Answer

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

con = 0

ans = "Yes"

if len(set(S)) != len(set(T)):
  print("No")
else:
  for i in range(0,len(S)):
    for j in range(i,len(S)):
      if T[i] == T[j]:
        if S[i] != S[j]:
          ans = "No"
          break
      break
      if S[i] == S[j]:
        if T[i] != T[j]:
          ans = "No"
          break
      break


  print(ans)

Submission status: Wrong Answer

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

con = 0

ans = "Yes"

for i in range(0,len(S)):
  for j in range(i,len(S)):
    if T[i] == T[j]:
      if S[i] != S[j]:
        ans = "No"
        break       
      break
    if S[i] == S[j]:
      if T[i] != T[j]:
        ans = "No"
        break
      break


print(ans)

Submission status: Wrong Answer

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

con = 0

ans = "Yes"

if len(set(S)) != len(set(T)):
  print("No")
  
else:
  for i in range(0,len(S)):
    for j in range(i,len(S)):
      if T[i] == T[j]:
        if S[i] != S[j]:
          ans = "No"
          break
        break
      if S[i] == S[j]:
        if T[i] != T[j]:
          ans = "No"
          break
        break


  print(ans)

Submission status: Wrong Answer

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

dic1 = {}
dic2 = {}

for i in range(0,len(S)):
  s = S[i]
  t = T[i]
  dic1[s] = t
  dic2[t] = s
  
if len(dic1) == len(set(S)) and len(dic2) == len(set(T)):
  print("Yes")
else:print("No")

Submission status: Wrong Answer

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

dic1 = {}
dic2 = {}

for i in range(0,len(S)):
  s = S[i]
  t = T[i]
  dic1[s] = t
  dic2[t] = s
  

  
if len(dic1) != len(dic2):
  print("No")
else:print("Yes")

Submission status: Wrong Answer

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

setS = set(S)  
setT = set(T)

if len(setS) != len(setT):
  print("No")
else:print("Yes")

Submission status: Wrong Answer

Solution code:
s=input()
t=input()
n=len(s)
A='abcdefghijklmnopqrstuvwxyz'
i=0
while A and i<n:
	if s==t:
		print('Yes')
		exit()
	if s[i]!=t[i]:
		if s[i] in A and t[i] in A:
			s=s.replace(s[i],'X').replace(t[i],s[i]).replace('X',t[i])
			A=A.replace(s[i],'').replace(t[i],'')
	i+=1
print('No')

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
from sys import stdin
import fractions

s = stdin.readline().rstrip()
t = stdin.readline().rstrip()
sli = []
li = []
for i in range(len(s)):
    sli.append(s[i])
    if s[i] != t[i]:
        li.append((s[i],t[i]))
li.sort()
sli = list(set(sli))

for i in range(len(li)-1):
    if li[i][0] == li[i+1][0]:
        if li[i][1] != li[i+1][1]:
            print("No")
            exit()
    if li[i][1] not in sli:
        print("No")
        exit()

li.sort(key=lambda x:(x[1]))

for i in range(len(li)-1):
    if li[i][0] != li[i+1][0]:
        if li[i][1] == li[i+1][1]:
            print("No")
            exit()

print("Yes")

Submission status: Wrong Answer

Solution code:
from sys import stdin
import fractions

s = stdin.readline().rstrip()
t = stdin.readline().rstrip()
li = []
for i in range(len(s)):
    if s[i] != t[i]:
        li.append((s[i],t[i]))

li.sort()

for i in range(len(li)-1):
    if li[i][0] == li[i+1][0]:
        if li[i][1] != li[i+1][1]:
            print("No")
            exit()

li.sort(key=lambda x:(x[1]))

for i in range(len(li)-1):
    if li[i][0] != li[i+1][0]:
        if li[i][1] == li[i+1][1]:
            print("No")
            exit()

print("Yes")

Submission status: Wrong Answer

Solution code:
s = input()
t = input()
abc = "abcdefghijklmnopqrstuvwxyz"

com = []
for i in range(len(abc)):
	if abc[i] in s and abc[i] in t:
		com.append(abc[i])

for i in range(len(com)):
	a = 0
	for j in range(len(s)):
		if com[i] == s[j]:
			if a == 0:
				st = t[j]
				a = 1
			else:
				if t[j] != st:
					print("No")
					exit(0)
	a = 0
	for j in range(len(t)):
		if com[i] == t[j]:
			if a == 0:
				st = s[j]
				a = 1
			else:
				if s[j] != st:
					print("No")
					exit(0)
print("Yes")

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

c1_c2_dict = {}

for i in range(len(S)):

  if S[i] in c1_c2_dict and c1_c2_dict[S[i]]!=T[i]:
    print("No")
    break
  elif  S[i] not in c1_c2_dict:
    c1_c2_dict[S[i]]=T[i]
    c1_c2_dict[T[i]]=S[i]
else:
  print("Yes")

Submission status: Wrong Answer

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

c1_c2_dict = {}

for i in range(len(S)):

  if S[i] in c1_c2_dict and c1_c2_dict[S[i]]!=T[i]:
    print("No")
    break
  elif  S[i] not in c1_c2_dict:
    c1_c2_dict[S[i]]=T[i]
else:
  print("Yes")

Submission status: Wrong Answer

Solution code:
import collections
S = input()
T = input()
S_dict = collections.Counter(S)
T_dict = collections.Counter(T)
S_dict = list(S_dict.keys())
T_dict = list(T_dict.keys())

if len(S_dict) <= len(T_dict):
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

Solution code:
import collections
S = input()
T = input()
S_dict = collections.Counter(S)
T_dict = collections.Counter(T)
S_dict = list(S_dict.keys())
T_dict = list(T_dict.keys())

if len(S_dict) == len(T_dict):
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

Solution code:
from collections import Counter

S = input()
T = input()

s = Counter(S)
t = Counter(T)


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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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


ans = "Yes"

for i in range(0,len(S)):
  for j in range(0,i):
    if S[j] == S[i]:
      if T[i] == T[j]:
        continue
      else:
        ans = "No"
        break
    if T[j] == T[i]:
      if S[j] == S[i]:
        continue
      else:
        ans == "No"

print(ans)

Submission status: Wrong Answer

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

ans = "Yes"

for i in range(0,len(S)):
  for j in range(0,i):
    if S[j] == S[i]:
      if T[i] == T[j]:
        continue
      else:
        ans = "No"
        print(ans)
        break
    break
  if T[i] == S[i]:
    for k in range(0,i):
      if T[i] == T[k] and S[k] != T[k]:
        ans = "No"
        print(ans)
        break
    break
if ans == "Yes":
  print(ans)

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
print("Yes" if len(set(input())) == len(set(input())) else "No")

Submission status: Wrong Answer

Solution code:
s=input()
t=input() 
from collections import Counter 
c1=Counter(s)
c2=Counter(s)
l1=[c1[i] for i in c1]
l2=[c2[i] for i in c2]
l1.sort() 
l2.sort()
print('Yes' if l1==l2 else 'No')

Submission status: Wrong Answer

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

s_map = []
t_map = []
for i in range(len(S)):
    if not S[i] in [S[m] for m in s_map]:
        s_map.append(i)

    if not T[i] in [T[m] for m in t_map]:
        t_map.append(i)

print('Yes' if s_map == t_map else 'No')

Submission status: Wrong Answer

Solution code:
def main():
    s=input()
    t=input()
    n=len(s)
    zumi=[]
    for i in range(n):
        ss= s[i]
        st= t[i]
        if ss != st:
            if st in zumi:
                return "No"
            zumi.append(st)
            s=s.translate(str.maketrans({ss:st,st:ss}))
    return "Yes"

print(main())

Submission status: Wrong Answer

Solution code:
w1 = input()
w2 = input()

s1 = list(w1)
s2 = list(w2)
s1.sort()
s2.sort()

c1 = 0
t1 = ""
a1 = []
for i1 in range(len(s1)):
    if s1[i1] != t1:
        a1.append(c1)
        t1 = s1[i1]
        c1 = 1
        if i1 == len(s1) - 1:
            a1.append(c1)
    else:
        c1 += 1
        if i1 == len(s1) - 1:
            a1.append(c1)

c1 = 0
t1 = ""
a2 = []
for i2 in range(len(s2)):
    if s2[i2] != t1:
        a2.append(c1)
        t1 = s2[i2]
        c1 = 1
        if i2 == len(s2) - 1:
            a2.append(c1)
    else:
        c1 += 1
        if i2 == len(s2) - 1:
            a2.append(c1)

if a1 == a2:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
S = input()
T = input()
SD = dict()
TD = dict()

valid = True
for s, t in zip(S, T):
    if s not in SD.keys():
        SD[s] = t
    if t not in TD.keys():
        TD[t] = s
    else:
        if SD[s] != t:
            valid = False
            break
        if TD[t] != s:
            valid = False
            break

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

Submission status: Wrong Answer

Solution code:
S = input()
T = input()
d = dict()
check1 = dict()
check2 = dict()
for i in "abcdefghijklmnopqrstuvwxyz":
    check1[i] = False
    check2[i] = False
for i in range(len(S)):
    if check2[S[i]]:
        if S[i] == T[i]:print("No");exit()
    if not check1[S[i]]:
        check1[S[i]] = True
        d[S[i]] = T[i]
        check2[T[i]] = True
    else:
        if d[S[i]] != T[i]:print("No");exit()
print("Yes")

Submission status: Wrong Answer

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

convert = dict()

answer = 'Yes'
for s, t in zip(S, T):
    if s in convert and convert[s] != t:
        answer = 'No'
        break
    else:
        convert[s] = t

print(answer)

Submission status: Wrong Answer

Solution code:
usedlist=[]
flag1=True
flag2=True

for i in range(2):
    if i==0:
        a=input()
    else:
        b=input()

n=len(a)
uselist=[0]*n
for i in range(n):
    if a[i]!=b[i]:
        uselist[i]=(a[i],b[i])
    if a[i]==b[i]:
        uselist[i]=0
  
sets=set(uselist)
dicti={"a":0,"b":0,"c":0,"d":0,"e":0,"f":0,"g":0,"h":0,"i":0,"j":0,"k":0,"l":0,"m":0,"n":0,"o":0,"p":0,"q":0,"r":0,"s":0,"t":0,"u":0,"v":0,"w":0,"x":0,"y":0,"z":0}
dicti2={"a":0,"b":0,"c":0,"d":0,"e":0,"f":0,"g":0,"h":0,"i":0,"j":0,"k":0,"l":0,"m":0,"n":0,"o":0,"p":0,"q":0,"r":0,"s":0,"t":0,"u":0,"v":0,"w":0,"x":0,"y":0,"z":0}

for i in sets:
    if i!=0:
        dicti[i[0]]+=1
        dicti2[i[1]]+=1
for i in dicti.values():
    if i>=2:
        flag1=False
        
        
for i in dicti2.values():
    if i>=2:
        flag2=False
        

if flag1 and flag2:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
usedlist=[]
flag=True

for i in range(2):
    if i==0:
        a=input()
    else:
        b=input()

n=len(a)
uselist=[0]*n
for i in range(n):
    uselist[i]=(a[i],b[i])
sets=set(uselist)
dicti={"a":0,"b":0,"c":0,"d":0,"e":0,"f":0,"g":0,"h":0,"i":0,"j":0,"k":0,"l":0,"m":0,"n":0,"o":0,"p":0,"q":0,"r":0,"s":0,"t":0,"u":0,"v":0,"w":0,"x":0,"y":0,"z":0}

for i in sets:
    dicti[i[0]]+=1
for i in dicti.values():
    if i>=2:
        flag=False
if flag:
    print("Yes")
else:
    print("No")