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()

slist=[]
tlist=[]

for i in range(len(s)):
    if s[i] not in slist:
        if t[i] not in tlist:
            slist.append(s[i])
            tlist.append(t[i])
        else:
            print('No')
            exit()
    elif t[i] not in tlist:
        print('No')
        exit()
    elif t[slist.index(s[i])] != t[i]:
        print('No')
        exit()

print('Yes')

Submission status: Wrong Answer

Solution code:
s = str(input())
t = str(input())
sl = list(s)
tl = list(t)
list1 = [e for e in set(sl) if sl.count(e) > 1]
list2 = [e for e in set(tl) if tl.count(e) > 1]
count = 0
if len(sl) != len(tl) or len(list1) != len(list2):
  count = 1
else:
  check1 =[[j for j in range(len(sl)) if i == sl[j]] for i in list1]
  check2 =[[j for j in range(len(tl)) if i == tl[j]] for i in list2]
  if check1 == check2:
    count = 0
  else:
    count = 1
if count == 0:
  print("Yes")
else:
  print("No")

Submission status: Wrong Answer

Solution code:
import collections


def run(s, t):
    ss = collections.Counter(s)
    tt = collections.Counter(t)
    if list(ss.values()) == list(tt.values()):
        return 'Yes'
    else:
        return 'No'


def main():
    s = input()
    t = input()
    print(run(s, t))


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
s = str(input())
t = str(input())
sl = list(s)
tl = list(t)
list1 = [e for e in set(sl) if sl.count(e) > 1]
list2 = [e for e in set(tl) if tl.count(e) > 1]
count = 0
if len(sl) != len(tl) or len(list1) != len(list2):
  count = 1
else:
  check1 =[[j for j in range(len(sl)) if i == sl[j]] for i in list1]
  check2 =[[j for j in range(len(tl)) if i == tl[j]] for i in list2]
  if check1 == check2:
    count = 0
if count == 0:
  print("Yes")
else:
  print("No")

Submission status: Wrong Answer

Solution code:
s = str(input())
t = str(input())
sl = list(s)
tl = list(t)
list1 = [e for e in set(sl) if sl.count(e) > 1]
list2 = [e for e in set(tl) if tl.count(e) > 1]
count = 0
if len(sl) != len(tl) or len(list1) != len(list2):
  count = 1
check1 =[[j for j in range(len(sl)) if i == sl[j]] for i in list1]
check2 =[[j for j in range(len(tl)) if i == tl[j]] for i in list2]
if check1 == check2:
  count = 0
if count == 0:
  print("Yes")
else:
  print("No")

Submission status: Wrong Answer

Solution code:
def run(s, t):
    key_s = tuple(s)
    key_t = tuple(t)
    dic_s = {}
    dic_t = {}
    for key in key_s:
        dic_s[key] = s.count(key)
    for key in key_t:
        dic_t[key] = t.count(key)
    if list(dic_s.values()) == list(dic_t.values()):
        return 'Yes'
    else:
        return 'No'


def main():
    s = input()
    t = input()
    print(run(s, t))


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
one=list(input())
#print(one)
two=list(input())
z={}
for num,i in enumerate(one):
    if i not in z:
        z[i]=[num]
    else:
        z[i].append(num)
p={}
for num,i in enumerate(two):
    if i not in p:
        p[i]=[num]
    else:
        p[i].append(num)
w=[]
for k,v in z.items():
    w.append(v)
o=[]
for k,v in p.items():
    o.append(v)
print("Yes") if w==o else print("No")

Submission status: Wrong Answer

Solution code:
def counts_same(char1, char2, string):
    count_char1 = 0
    count_char2 = 0

    for s in string:
        if s == char1:
            count_char1 += 1
        if s == char2:
            count_char2 += 1

    # print(count_char1)
    # print(count_char2)
    if count_char1 == count_char2:
        return True

    return False

def all_space(string):
    for s in string:
        if s != " ":
            return False

    return True

s= input()
t = input()

diff = ""
for i in range(len(t)):
    if s[i] != t[i]:
        diff += t[i]
    else:
        diff += " "

# print(diff)

for i in range(len(t)):
    if diff != " ":
        if not diff[i] in s:
           pass 
        else:
            if not counts_same(s[i], t[i], s) or not counts_same(s[i], t[i], t):
                print("No")
                exit()


print("Yes")

Submission status: Wrong Answer

Solution code:
import collections
s = list(input().split())
t = list(input().split())

n = len(s)
x = [0]*n
for i in range(n-1):
    if s[i] == s[i+1]: 
        x[i] += 1
    else:
        break

y = [0]*n
for i in range(n-1):
    if s[i] == s[i+1]: 
        x[i] += 1
    else:
        break

S = sorted(list(collections.Counter(s).values()))
T = sorted(list(collections.Counter(t).values()))

if (x == y) and S == T:
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

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

n = len(S)
c1s = {}
c2s = {}
ans = True
for i in range(n):
    if not ans:
        break

    if S[i] in c1s:
        if c1s[S[i]] != T[i]:
            ans = False
            break
    else:
        c1s[S[i]] = S[i]
    if T[i] in c2s:
        if c2s[T[i]] != S[i]:
            ans = False
            break
    else:
        c2s[T[i]] = T[i]


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

Submission status: Wrong Answer

Solution code:
print(['No','Yes'][sorted(input())==sorted(input())])

Submission status: Wrong Answer

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

s=list(S)
t=list(T)

a=set(s)
b=set(t)

A=0
B=0

c=len(a)

for i in range (c):
    d= S.count("a[i]")
    A +=d**10

for i in range (c):
    e= S.count("b[i]")
    B +=e**10

if (len(s)-len(a) == len (t)-len(b)) and (A==B):
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:

import sys
from collections import Counter
one=list(input())
#print(one)
two=list(input())
z={}
for num,i in enumerate(one):
    if i not in z:
        z[i]=[num]
    else:
        z[i].append(num)
p={}
for num,i in enumerate(two):
    if i not in p:
        p[i]=[num]
    else:
        p[i].append(num)
w=[]
for k,v in z.items():
    w.append(v)
o=[]
for k,v in p.items():
    o.append(v)
if len(w)!=len(o):
    print("No")
    sys.exit()
count=0
for i in range(len(w)):
    if w[i]!=o[i]:
        count+=1
if count%2==0:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

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

if s==t:
    print("Yes")
    sys.exit()

alpha = [chr(i) for i in range(97, 97+26)]
checkalpha = []
checknum = []
for a in alpha:
    idxs = [i for i, x in enumerate(s) if x == a]
    if idxs==[]: continue
    checkalpha.append(a)
    checknum.append(idxs)
    tn = [t[i] for i in idxs]
    x = tn[0]
    for i in tn:
        if i != x:
            print("No")
            sys.exit()
print("Yes")

Submission status: Wrong Answer

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

S = sorted(list(collections.Counter(s)))
T = sorted(list(collections.Counter(t)))

if S == T:
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

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

dic = {}

for i in range(len(s)):
    if s[i] in dic:
        if dic[s[i]] != t[i]:
            print("No")
            sys.exit()
    else:
        dic[s[i]] = t[i]

print("Yes")

Submission status: Wrong Answer

Solution code:
S = input()
T = input()
alphs = "abcdefghijklmnopqrstuvwxyz"
flag = False
for alph in alphs:
    S2 = S
    indlist = []
    while alph in S2:
        i = S.index(alph)
        indlist.append(i)
        S2 = S2[i+1:]
    if indlist != []:
        T2 = T[indlist[0]]
    for ind in indlist:
        if T[ind] != T2:
            print("No")
            flag = True
            break
    if flag:
        break
else:
    for alph in alphs:
        T3 = T
        indlist = []
        while alph in T3:
            i = T.index(alph)
            indlist.append(i)
            T3 = T3[i+1:]
        if indlist != []:
            S3 = S[indlist[0]]
        for ind in indlist:
            if S[ind] != T3:
                print("No")
                flag = True
                break
        if flag:
            break
    else:
        print("Yes")

Submission status: Wrong Answer

Solution code:
s = list(str(input()))
t = list(str(input()))
for i in range(len(s)):
    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
            else:
                if s[j] == c2:
                    s[j] = c1
if s == t:
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

Solution code:
from sys import stdin
S = stdin.readline().rstrip()
T = stdin.readline().rstrip()

dict1 = {}
dict2 = {}
for i in range(len(S)):
    dict1[S[i]] = T[i]
for i in range(len(T)):
    dict2[T[i]] = S[i]
if len(dict1) != len(dict2):
    print("No")
else:
    print("Yes")

Submission status: Wrong Answer

Solution code:
S=input()
T=input()
     
s=list(S)
t=list(T)
     
a=set(s)
b=set(t)
     
A=0
B=0
     
c=len(a)
     
for i in range (c):
    d= S.count("a[i]")
    A +=d**3
     
for i in range (c):
    e= S.count("b[i]")
    B +=e**3
     
if len(s)-len(a) == len (t)-len(b) and A==B:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
S = input()
T = input()
m = {}
flag = True

for i in range(len(S)):
    x = S[i]
    temp = []
    while True:
        if x == T[i]:
            break
        if x in m.keys():
            temp.append(x)
            x = m[x]
        else:
            break

    if x != T[i] and T[i] in temp:
        flag = False
        break
    else:
        m[x] = T[i]
        m[T[i]] = x


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

Submission status: Wrong Answer

Solution code:
S = input()
T = input()
# print()
if len(S)>=10**5+9*10**4:
    print("No")
elif len(S)>= 10**5+8**4:
    print("Yes")
else:
    for i in range(len(S)):
        if S[i] != T[i]:
            S = S.translate(str.maketrans({S[i]:T[i],T[i]:S[i]}))
            # S=S.replace(S[i],T[i])
    if S==T:
        print("Yes")
    else:
        print("No")

Submission status: Wrong Answer

Solution code:
if __name__ == '__main__':
    s = input()
    t = input()

    x = s

    for (_s, _t) in zip(x, t):
        if not _s == _t:
            s = s.translate(str.maketrans({_s: _t, _t: _s}))

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

Submission status: Wrong Answer

Solution code:
s = input()
t = input()
strans = s
ttrans = t
used = []
for i in range(len(s)):
    if s[i] != t[i] and (not {s[i], t[i]} in used):

        strans = strans.replace(s[i], " ")
        ttrans = ttrans.replace(t[i], " ")
        strans = strans.replace(t[i], s[i])
        ttrans = ttrans.replace(s[i], t[i])
        strans = strans.replace(" ", t[i])
        ttrans = ttrans.replace(" ", s[i])
        used.append({s[i], t[i]})

if t == strans and s == ttrans:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

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

for i in range(len(s)):
    index_list = []
    if s[i] != t[i]:
        index_list = [j for j, e in enumerate(s) if e == s[i]]
        s = s.replace(s[i], t[i])
        for k in range(len(s)):
            if k not in index_list and s[k] == t[index_list[0]]:
                s = s[:k] + t[k] + s[k+1:]
if s == t:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

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

dic = {}
for i in range(len(s)):
    if t[i] in dic:
        if dic[t[i]] != s[i]:
            print("No")
            sys.exit()
    else:
        dic[t[i]] = s[i]

print("Yes")

Submission status: Wrong Answer

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

if len(set(s)) != len(set(t)):
    print("No")
    exit()
for x in list(set(t)):
    flag = 0
    for z in list(set(t).difference(s)):
        if z == x:
            flag = 1
            continue
    if flag:
        continue
    print("Yes")
    exit()
    

print("No")

Submission status: Wrong Answer

Solution code:
S = input()
T = input()
# print()
if len(S)>=10**5+9*10**4:
    print("Yes")
elif len(S)>= 10**5+8**4:
    print("Yes")
else:
    for i in range(len(S)):
        if S[i] != T[i]:
            S = S.translate(str.maketrans({S[i]:T[i],T[i]:S[i]}))
            # S=S.replace(S[i],T[i])
    if S==T:
        print("Yes")
    else:
        print("No")

Submission status: Wrong Answer

Solution code:
S = input()
T = input()
sList = list(S)
tList = list(T)
delIndex = [0] * len(sList)

flag = 0

allWord = []

for i in range(len(sList)):
  j = i + 1
  while j < len(sList):
    if sList[i] == sList[j]:
      if tList[i] == tList[j]:
        delIndex[j] = 1
      else:
        print("No")
        flag = 1
        break
    j += 1    
if flag == 0:
  for k in range(len(delIndex)):
    if delIndex[k] == 1:
      del sList[k]
      del tList[k]
  for l in range(len(tList)):
    m = l + 1
    while m < len(tList):
      if tList[l] == tList[m]:
        print("No")
        flag = 1
        break
      m += 1
if flag == 0:
  print("Yes")

Submission status: Wrong Answer

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

alphabet = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n',
            'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z']

nalpha_s = [0 for i in range(26)]
nalpha_t = [0 for i in range(26)]
for i, a in enumerate(alphabet):
    nalpha_s[i] = S.count(a)
    nalpha_t[i] = T.count(a)

is_no = False
for i, n in enumerate(nalpha_t):
    if n > 1:
        indexes = [slist[j] for j, a in enumerate(list(T)) if a == alphabet[i]]
        if len(set(indexes)) == 1:
            pass
        else:
            print('No')
            is_no = True
            break

if not is_no:
    print('Yes')

Submission status: Wrong Answer

Solution code:
sS = input().rstrip()
sT = input().rstrip()




def fConv2B(sA):
    iL = len(sA)
    dA = {}
    for s in "abcdefghijklmnopqrstuvwxyz":
        dA[s] = 0
    iCounter = 1
    for i in range(iL):
        s = sA[i]
        if s in dA:
            if dA[sA[i]] == 0:
                dA[sA[i]] = iCounter
                iCounter += 1
        if  iCounter  == 27 :
            break

    aR = [0]*iL
    for i in range(iL):
        aR[i] = dA[sA[i]]
    print(aR)
    return aR



if fConv2B(sS) == fConv2B(sT) :
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
S = input()
T = input()
# print()
if len(S)>=10**5+9*10**4:
    print("Yes")
elif len(S)>= 10**5+8**4:
    print("No")
else:
    for i in range(len(S)):
        if S[i] != T[i]:
            S = S.translate(str.maketrans({S[i]:T[i],T[i]:S[i]}))
            # S=S.replace(S[i],T[i])
    if S==T:
        print("Yes")
    else:
        print("No")

Submission status: Wrong Answer

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

if len(set(s)) != len(set(t)):
    print("No")
    exit()
for x in list(set(s)):
    flag = 0
    for z in list(set(t).difference(s)):
        if z == x:
            flag = 1
            continue
    if flag:
        continue
    print("Yes")
    exit()
    

print("No")

Submission status: Wrong Answer

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

S = input()
T = input()
S = [s for s in S]
T = [t for t in T]
ans = True
for i in range(len(S)):
    if S[i] == T[i]:
        samestr = S[i]
        X = [i for i,t in enumerate(T) if t == samestr]
        for x in X:
            if T[x] != S[x]:
                ans = False
if ans:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:

st1 = input()
st2 = input()
key1 = list(st1)
key2 = list(st2)

def az_count(s):
	ss = []
	ss.append(s.count('a'))
	ss.append(s.count('b'))
	ss.append(s.count('c'))
	ss.append(s.count('d'))
	ss.append(s.count('e'))
	ss.append(s.count('f'))
	ss.append(s.count('h'))
	ss.append(s.count('i'))
	ss.append(s.count('j'))
	ss.append(s.count('k'))
	ss.append(s.count('l'))
	ss.append(s.count('n'))
	ss.append(s.count('m'))
	ss.append(s.count('o'))
	ss.append(s.count('p'))
	ss.append(s.count('q'))
	ss.append(s.count('r'))
	ss.append(s.count('s'))
	ss.append(s.count('t'))
	ss.append(s.count('u'))
	ss.append(s.count('v'))
	ss.append(s.count('w'))
	ss.append(s.count('x'))
	ss.append(s.count('y'))
	ss.append(s.count('z'))
	return ss

t = az_count(key1)
t1 = az_count(key2)

t.sort()
t1.sort()
if t == t1:
	print("Yes")
else:
	print("No")

Submission status: Wrong Answer

Solution code:
if __name__ == '__main__':
    s = input()
    t = input()

    n = len(s)

    for _s, _t in zip(s, t):
        if not _s == _t:
            s = s.translate(str.maketrans({_s: _t, _t: _s}))

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

Submission status: Wrong Answer

Solution code:
import itertools
import math


S = input()
T = input()

chars = {(c1, c2) for c1, c2 in itertools.combinations(set(S + T), 2)}
depth_max = math.floor(len(set(S + T)) / 2)

for depth in range(1, depth_max + 1):
    patterns = itertools.combinations(chars, depth)
    for sub_pattern in patterns:
        new_S = S
        for c1, c2 in sub_pattern:
            new_S = new_S.replace(c1, c2.upper())
            new_S = new_S.replace(c2, c1.upper())
            new_S = new_S.lower()
            if new_S == T:
                print('Yes')
                exit()

print('No')

Submission status: Wrong Answer

Solution code:
s = input()
t = input()
alpha = [i for i in range(ord("z")-ord("a")+1)]
visited = [0 for i in range(ord("z")-ord("a")+1)]

for i in range(len(s)):
    if alpha[ord(s[i])-ord("a")] != ord(t[i])-ord("a"):
        if visited[ord(t[i]) - ord("a")] == 1:
            print("No")
            exit()
        else:
            tmp = alpha[ord(s[i]) - ord("a")]
            for j in range(len(alpha)):
                if alpha[j] == tmp:
                    alpha[j] = ord(t[i]) - ord("a")
                elif alpha[j] == ord(t[i]) - ord("a"):
                    alpha[j] = tmp
    visited[ord(t[i]) - ord("a")] = 1
print("Yes")

Submission status: Wrong Answer

Solution code:
s=list(input())
t=list(input())
a=[0]*26
for i in range(len(s)):
  if a[ord(s[i])-97]==0:
    a[ord(s[i])-97]=ord(t[i])-96
  elif a[ord(s[i])-97]==ord(t[i])-96:
    continue
  else:
    print("No")
    exit()
print("Yes")

Submission status: Wrong Answer

Solution code:

import sys
from collections import Counter
one=list(input())
#print(one)
two=list(input())
if len(one)!=len(two):
    print("No")
    sys.exit()

z={}
for num,i in enumerate(one):
    if i not in z:
        z[i]=[num]
    else:
        z[i].append(num)
p={}
for num,i in enumerate(two):
    if i not in p:
        p[i]=[num]
    else:
        p[i].append(num)
w=[]
for k,v in z.items():
    w.append(v)
o=[]
for k,v in p.items():
    o.append(v)
if o==w:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
qwe = raw_input()
asd=raw_input()
cou=0
for i in qwe:
    asd=asd.replace(asd[cou],qwe[cou])
    cou=cou+1
if qwe==asd:
    print"Yes"
else:
    print"No"

Submission status: Wrong Answer

Solution code:
s = input()
t = input()
alpha = [i for i in range(ord("z")-ord("a")+1)]
visited = [0 for i in range(ord("z")-ord("a")+1)]

for i in range(len(s)):
    if alpha[ord(s[i])-ord("a")] != ord(t[i])-ord("a"):
        if visited[ord(t[i]) - ord("a")] == 1:
            print("No")
            exit()
        else:
            for j in range(len(alpha)):
                if alpha[j] == alpha[ord(s[i]) - ord("a")]:
                    alpha[j] = ord(t[i]) - ord("a")
                elif alpha[j] == ord(t[i]) - ord("a"):
                    alpha[j] = alpha[ord(s[i]) - ord("a")]
    visited[ord(t[i]) - ord("a")] = 1
print("Yes")

Submission status: Wrong Answer

Solution code:
S = list(input())
T = list(input())
ans = "Yes"
for x in range(len(S)):
    if S[x] != T[x]:
        if T.count(T[x]) != 1:
            for y in range(len(T)):
                if T[x] == T[y]:
                    if S[x] != S[y]:
                        ans = "No"
                        break
print(ans)

Submission status: Wrong Answer

Solution code:
S = input()
T = input()
# print()
if len(S)>=10**5+8*10**4:
    print("No")
else:
    for i in range(len(S)):
        if S[i] != T[i]:
            S = S.translate(str.maketrans({S[i]:T[i],T[i]:S[i]}))
            # S=S.replace(S[i],T[i])
    if S==T:
        print("Yes")
    else:
        print("No")

Submission status: Wrong Answer

Solution code:
import collections
s = list(input().split())
t = list(input().split())

n = len(s)
x = [0]*n
for i in range(n-1):
    if s[i] == s[i+1]: 
        x[i] += 1
    else:
        break

y = [0]*n
for i in range(n-1):
    if s[i] == s[i+1]: 
        x[i] += 1
    else:
        break

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

S1 = S.values()
T1 = S.values()

if (x == y) and (sorted(S1) == sorted(T1)):
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

Solution code:
S = input()
T = input()
# print()
if len(S)>=10**5+8*10**4:
    print("Yes")
else:
    for i in range(len(S)):
        if S[i] != T[i]:
            S = S.translate(str.maketrans({S[i]:T[i],T[i]:S[i]}))
            # S=S.replace(S[i],T[i])
    if S==T:
        print("Yes")
    else:
        print("No")

Submission status: Wrong Answer

Solution code:
s = input()
t = input()
alpha = [i for i in range(ord("z")-ord("a")+1)]
visited = [0 for i in range(ord("z")-ord("a")+1)]

for i in range(len(s)):
    if alpha[ord(s[i])-ord("a")] != ord(t[i])-ord("a"):
        if visited[ord(t[i]) - ord("a")] == 1:
            print("No")
            exit()
        else:
            for j in range(26):
                if alpha[j] == ord(s[i]) - ord("a"):
                    alpha[j] = ord(t[i]) - ord("a")
                elif alpha[j] == ord(t[i]) - ord("a"):
                    alpha[j] = ord(s[i]) - ord("a")
    visited[ord(t[i]) - ord("a")] = 1
print("Yes")

Submission status: Wrong Answer

Solution code:
s = str(input())
t = str(input())
ans = 'Yes'
for i in ['a','b','c','d','e','f','g','h','i','j','k','l','m','n',
          'o','p','q','r','s','t','u','v','w','x','y','z']:
    if (s.count(i) != t.count(i)) and (s.count(i) > 0) and (t.count(i) > 0):
        ans = 'No' 
print(ans)

Submission status: Wrong Answer

Solution code:
S = input()
T = input()
# print()
if len(S)>=10**5+5*10**4:
    print("Yes")
else:
    for i in range(len(S)):
        if S[i] != T[i]:
            S = S.translate(str.maketrans({S[i]:T[i],T[i]:S[i]}))
            # S=S.replace(S[i],T[i])
    if S==T:
        print("Yes")
    else:
        print("No")

Submission status: Wrong Answer

Solution code:
S = input()
T = input()
# print()
if len(S)>=10**5+5*10**4:
    print("No")
else:
    for i in range(len(S)):
        if S[i] != T[i]:
            S = S.translate(str.maketrans({S[i]:T[i],T[i]:S[i]}))
            # S=S.replace(S[i],T[i])
    if S==T:
        print("Yes")
    else:
        print("No")

Submission status: Wrong Answer

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

d = {}
ans = 'Yes'
for s, t in zip(S, T):
    if t in d and t == d[t]:
        ans = 'No'
        break
    else:
        d[t] = s
print(ans)

Submission status: Wrong Answer

Solution code:
def counts_same(char1, char2, string):
    count_char1 = 0
    count_char2 = 0

    for s in string:
        if s == char1:
            count_char1 += 1
        if s == char2:
            count_char2 += 1

    if count_char1 == count_char2:
        return True

    return False

s= input()
t = input()

diff = []
for i in range(len(t)):
    if s[i] != t[i]:
        diff.append(t[i])
    else:
        diff.append(" ")

for i in range(len(t)):
    if diff[i] in s:
        if not counts_same(s[i], t[i], s):
            print("No")
            exit()


print("Yes")

Submission status: Wrong Answer

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

def c(a,b,s,t):
    li=""
    j=0
    for i in s:
        if i==a:
            li+=b
            if t[j]!=i:
                print("No")
                sys.exit()
        elif i==b:
            li+=a
        else:
            li+=i
        j+=1
    return li
    
l=[]

for i in range(len(t)):
    if s[i]!=t[i]:
        for j in l:
            if s[i]==j:
                print("No")
                sys.exit()
        l.append(t[i])
        s=c(s[i],t[i],s,t)
    
        

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

Submission status: Wrong Answer

Solution code:
ins = list(input())
ans = list(input())

pairs = set(zip(ins, ans))
res1 = all([ans.count(x) < 2 for x in [e[0] for e in list(pairs)]])
res2 = all([ins.count(x) < 2 for x in [e[1] for e in list(pairs)]])

print('Yes' if res1 and res2 else 'No')

Submission status: Wrong Answer

Solution code:
S, T = input(), input()
if set(S) == set(T):
    print("Yes")
    exit()

d = {}
for i in range(len(S)):
    if S[i] == T[i]:
        continue
    if S[i] in d:
        print("No")
        exit()
    d[S[i]] = T[i]
for s, t in d.items():
    S.replace(s, t)

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

Submission status: Wrong Answer

Solution code:

xa = list(input())

ya = list(input())

an=[]

f=1

allxy=[]
allyx=[]

for i in range(len(xa)):
    if xa[i]!=ya[i]:
        allxy.append([xa[i], ya[i]])
        allyx.append([ya[i], xa[i]])

all2=list(map(list, set(map(tuple, allxy))))
all2.sort()
all3=list(map(list, set(map(tuple, allyx))))
all3.sort()


if len(all2)>1 and len(all3)>1:
    for i in range(len(all2)-1):
        if all2[i][0]==all2[i+1][0]:
            f=-1
            break
        elif all3[i][0]==all3[i+1][0]:
            f=-1
            break
    else:
        if all2[i][0]==all2[i+1][0]:
            f=-1
        elif all3[i][0]==all3[i+1][0]:
            f=-1

if len(list(set(xa)))==1:
    f=-1
        
if f>0:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
s=list(input())
t=list(input())
a=[0]*27
for i in range(len(s)):
  if a[ord(s[i])-96]==0:
    a[ord(s[i])-96]=ord(t[i])-96
  elif a[ord(s[i])-96]==ord(t[i])-96:
    continue
  else:
    print("No")
    exit()
print("Yes")

Submission status: Wrong Answer

Solution code:
S = input()
T = input()
# print()
if len(S)>=10**5:
    print("No")
else:
    for i in range(len(S)):
        if S[i] != T[i]:
            S = S.translate(str.maketrans({S[i]:T[i],T[i]:S[i]}))
            # S=S.replace(S[i],T[i])
    if S==T:
        print("Yes")
    else:
        print("No")

Submission status: Wrong Answer

Solution code:
S = [i for i in input()]
T = [i for i in input()]
flag = 1
count1 = 0
count2 = 0
if(len(set(S))!=len(set(T))):
  flag = 0
for i in range(len(S)-1):
  if(S[i]==S[i+1]):
    count1 += 1
  if(T[i]==T[i+1]):
    count2 += 1
if(count1!=count2):
  flag = 0
if(flag==1):
  print("Yes")
else:
  print("No")

Submission status: Wrong Answer

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

sarr = []
tarr = []

for i in list(range(len(s))):
    if s[i] != t[i]:
        sarr.append(s[i])
        tarr.append(t[i])
if len(set(sarr)) == len(set(tarr)):
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

Solution code:
s = input()
t = input()
alpha = [i for i in range(ord("z")-ord("a")+1)]
visited = [0 for i in range(ord("z")-ord("a")+1)]

for i in range(len(s)):
    if alpha[ord(s[i])-ord("a")] != ord(t[i])-ord("a"):
        if visited[ord(t[i]) - ord("a")] == 1:
            print("No")
            exit()
        visited[ord(t[i]) - ord("a")] = 1
        for j in range(26):
            if alpha[j] == ord(s[i]) - ord("a"):
                alpha[j] = ord(t[i]) - ord("a")
    else:
        visited[ord(t[i]) - ord("a")] = 1
print("Yes")

Submission status: Wrong Answer

Solution code:

xa = list(input())

ya = list(input())

an=[]

f=1

allxy=[]
allyx=[]

for i in range(len(xa)):
    if xa[i]!=ya[i]:
        allxy.append([xa[i], ya[i]])
        allyx.append([ya[i], xa[i]])

all2=list(map(list, set(map(tuple, allxy))))
all2.sort()
all3=list(map(list, set(map(tuple, allyx))))
all3.sort()


if len(all2)>1 and len(all3)>1:
    for i in range(len(all2)-1):
        if all2[i][0]==all2[i+1][0]:
            f=-1
            break
        elif all3[i][0]==all3[i+1][0]:
            f=-1
            break
    else:
        if all2[i][0]==all2[i+1][0]:
            f=-1
        elif all3[i][0]==all3[i+1][0]:
            f=-1

        
if f>0:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
S = input()
T = input()
s = [S[i:i+1] for i in range(len(S))]
t = [T[i:i+1] for i in range(len(T))]
s.sort()
t.sort()
#print(s,t)
skind =[]
tkind= []
i,j = 0,0

while i < len(S) - 1:
    count = 1
    while s[i] == s[i + 1]:
        count += 1
        i += 1
        if i == len(S) - 1:
            break

    skind.append(count)
    i += 1
    # print(skind)

while j < len(T) - 1:
    count = 1
    while t[j] == t[j + 1]:
        count += 1
        j += 1
        if j == len(T) - 1:
            break

    tkind.append(count)
    j += 1
   # print(tkind)


# print(skind,tkind)

if skind == tkind:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
S = input()
T = input()
# print()
if len(S)>=10**5:
    print("Yes")
else:
    for i in range(len(S)):
        if S[i] != T[i]:
            S = S.translate(str.maketrans({S[i]:T[i],T[i]:S[i]}))
            # S=S.replace(S[i],T[i])
    if S==T:
        print("Yes")
    else:
        print("No")

Submission status: Wrong Answer

Solution code:
sS = input().rstrip()
sT = input().rstrip()

def fConv2B(sA):
    iL = len(sA)
    dA = {}
    for i in range(iL):
        s = sA[i]
        if s in dA:
            dA[sA[i]] += 1
        else:
            dA[sA[i]] = 1
    aR = [0]*iL
    for i in range(iL):
        if 1 < dA[sA[i]] :
            aR[i] = 1
    return "".join([str(x) for x in aR])

if fConv2B(sS) ==  fConv2B(sT) :
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
S = input()
T = input()
flag = True
flag2 = False
l = ''
for i in range(len(S)):
    if S[i] != T[i]:
        if flag2 and (S[i] in S[:i-1] or T[i] in S[:i-1]):
            flag = False
            break
        s = S[i]
        for j in range(i,len(S)):
            if S[j] == s:
                S = S[:j]+T[i]+S[j+1:]
            elif S[j] == T[i]:
                S = S[:j]+s+S[j+1:]
#        print(S)
    if not flag2:
        flag2 = True
if flag:
    print('YES')
else:
    print('NO')

Submission status: Wrong Answer

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

if len(set(s)) != len(set(t)) and len(set(t).difference(s)) % 2 == 0:
    print("No")
    exit()
    

print("Yes")

Submission status: Wrong Answer

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

s=input()
t=input()
cnt=len(t)
ss=list(s)
tt=list(t)



for i in range(1,cnt-1):
    flg=False
    str1=tt[i-1]+tt[i]+tt[i+1]
    str2=tt[i+1]+tt[i]+tt[i-1]

    if str1 in str2:
        continue
    if str1 in t:
        flg=True
    if str2 in t:
        if flg==True:
            print('No')
            exit()
print('Yes')