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()
visited=[]

for i in range(len(S)):
    if (S[i] not in visited) and S[i]!=T[i]:
        visited.append(T[i])
        x=S[i]
        S=S.replace(T[i],'_')
        S=S.replace(S[i],T[i])
        S=S.replace('_',x)
    elif (S[i] in visited and S[i]!=T[i]) or len(visited)==26:
        break
    else:
        visited.append(T[i])
print('No') if S!=T else print('Yes')

Submission status: Wrong Answer

Solution code:
S=input()
T=input()
visited=[]
flag=1

for i in range(len(S)):
    if (S[i] not in visited) and (T[i] not in visited) and S[i]!=T[i]:
        visited.append(S[i])
        visited.append(T[i])
        x=S[i]
        S=S.replace(T[i],'_')
        S=S.replace(S[i],T[i])
        S=S.replace('_',x)
    elif ((S[i] in visited) or (T[i] in visited)) and S[i]!=T[i]:
        flag=0
        break
    else:
        visited.append(S[i])
print('No') if flag==0 else print('Yes')

Submission status: Wrong Answer

Solution code:
import sys
S = input()
T = input()
st = [S[i]+T[i] for i in range(len(T))]
atoz = [chr(i) for i in range(97, 97+26)]
st = list(set(st))
for i in atoz:
    if len([s for s in st if s[0]==i]) >= 2:
        print("No")
        sys.exit()
print("Yes")

Submission status: Wrong Answer

Solution code:
import sys
S = input()
T = input()
st = [T[i]+S[i] for i in range(len(T))]
atoz = [chr(i) for i in range(97, 97+26)]
st = list(set(st))
for i in atoz:
    if len([s for s in st if s[0]==i]) >= 2:
        print("No")
        sys.exit()
print("Yes")

Submission status: Wrong Answer

Solution code:
import sys
S = input()
T = input()
st = [T[i]+S[i] for i in range(len(T)) if not S[i] == T[i]]
atoz = [chr(i) for i in range(97, 97+26)]
st = list(set(st))
for i in atoz:
    if len([s for s in st if s[0]==i]) >= 2:
        print("No")
        sys.exit()
print("Yes")

Submission status: Wrong Answer

Solution code:
def solve(S, T):
    StoT = {}
    TtoS = {}
    for s, t in zip(S, T):
        print('----------------')
        print(s, t)
        if s not in StoT:
            StoT[s] = t
        if t not in TtoS:
            TtoS[t] = s
        
        if StoT[s] != t or TtoS[t] != s:
            return False
        print(StoT)
        print(TtoS)

    return True
        


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

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

Submission status: Wrong Answer

Solution code:
# coding: utf-8
# Your code here!

import sys

T = [x for x in input()]
S = [x for x in input()]

S2T = dict()
for s, t in zip(S, T):
    if s in S2T:
        if S2T[s] != t:
            print('No')
            sys.exit()
    else:
        S2T[s] = t
        
count_nequal = sum([1 for k, v in S2T.items() if k != v])

if count_nequal == 26:
    print('No')
else:
    print('Yes')

Submission status: Wrong Answer

Solution code:
# coding: utf-8
# Your code here!

import sys

T = [x for x in input()]
S = [x for x in input()]

S2T = dict()
for s, t in zip(S, T):
    if s in S2T:
        if S2T[s] != t:
            print('No')
            sys.exit()
    else:
        S2T[s] = t
        
print('Yes')

Submission status: Wrong Answer

Solution code:
S = str(input())
T = str(input())
S_dict = {}
T_dict = {}
S_dict[S[0]] = 1
T_dict[T[0]] = 1
for i in range(1, len(S)):
    s, t = S[i], T[i]
    if s in S_dict.keys():
        if t in T_dict.keys():
            if S_dict[s] == T_dict[t]:
                S_dict[s] += 1
                T_dict[t] += 1
            else:
                print('No')
                quit()
        else:
            quit()
    else:
        if t in T_dict.keys():
            print('No')
            quit()
        else:
            S_dict[s] = 1
            T_dict[t] = 1

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

Submission status: Wrong Answer

Solution code:
from collections import Counter

S = str(input())
T = str(input())
s = Counter(S).most_common()
t = Counter(T).most_common()
if len(s) == len(t):
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

Solution code:
from collections import Counter
S=Counter(input())
T=Counter(input())
if len(S)==len(T):
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
S,T=input(),input()
s,t=[],[]
if len(S)==1:
    print('Yes')
else:
    for i in range(len(S)-1):
        for j in range(i+1,len(S)):
            if (S[i]==S[j] and T[i]!=T[j]) or (S[i]!=S[j] and T[i]==T[j]):
                print('No')
                break
    print('Yes')

Submission status: Wrong Answer

Solution code:
# coding: utf-8
# Your code here!
a=list(input())
b=list(input())
a_l=list(set(a))
b_l=list(set(b))
ans="No"
"""a_l.sort()
b_l.sort()
print(a_l,b_l)"""
if(len(a_l)==len(b_l) and len(a_l)%2==0):
     ans="Yes"
print(ans)

Submission status: Wrong Answer

Solution code:
# Your code here!
a=list(input())
b=list(input())
a_l=list(set(a))
b_l=list(set(b))
ans="No"
#print(a_l,b_l)
if(len(a_l)==len(b_l)):
     ans="Yes"
print(ans)

Submission status: Wrong Answer

Solution code:
from collections import Counter
S=input()
T=input()
s=list(S)
t=list(T)
a=Counter(s)
b=Counter(t)
c=a.most_common()
d=b.most_common()
flag=True
if d[0][1]>=2:
    e=[]
    for i in range(len(s)):
        if t[i]==d[0][0]:
            e.append(s[i])
    for i in range(len(e)-1):
        if e[i]!=e[i+1]:
            flag=False
if c[0][1]>=2:
    f=[]
    for i in range(len(s)):
        if s[i]==c[0][0]:
            f.append(t[i])
    for i in range(len(f)-1):
        if f[i]!=f[i+1]:
            flag=False
if flag:
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

Solution code:
from collections import Counter
S=input()
T=input()
s=list(S)
t=list(T)
a=Counter(s)
b=Counter(t)
c=a.most_common()
d=b.most_common()
flag=True
if d[0][1]>=2:
    e=[]
    for i in range(len(s)):
        if t[i]==d[0][0]:
            e.append(s[i])
    for i in range(len(e)-1):
        if e[i]!=e[i+1]:
            flag=False
elif c[0][1]>=2:
    f=[]
    for i in range(len(s)):
        if s[i]==c[0][0]:
            f.append(t[i])
    for i in range(len(f)-1):
        if f[i]!=f[i+1]:
            flag=False
if flag:
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

Solution code:
from collections import Counter
S=input()
T=input()
s=list(S)
t=list(T)
a=Counter(s)
b=Counter(t)
c=a.most_common()
d=b.most_common()
flag=True
if d[0][1]>=2 or c[0][1]>=2:
    e=[]
    for i in range(len(s)):
        if t[i]==d[0][0]:
            e.append(s[i])
    for i in range(len(e)-1):
        if e[i]!=e[i+1]:
            flag=False
if c[0][1]>=2:
    f=[]
    for i in range(len(s)):
        if s[i]==c[0][0]:
            f.append(t[i])
    for i in range(len(f)-1):
        if f[i]!=f[i+1]:
            flag=False
if flag:
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

Solution code:
from collections import Counter
S=input()
T=input()
s=list(S)
t=list(T)
a=Counter(s)
b=Counter(t)
c=a.most_common()
d=b.most_common()
flag=True
if d[0][1]>=2 or c[0][1]>=2:
    e=[]
    f=[]
    for i in range(len(s)):
        if t[i]==d[0][0]:
            e.append(s[i])
    for i in range(len(e)-1):
        if e[i]!=e[i+1]:
            flag=False
    for i in range(len(s)):
        if s[i]==c[0][0]:
            f.append(t[i])
    for i in range(len(f)-1):
        if f[i]!=f[i+1]:
            flag=False
if flag:
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

Solution code:
from collections import Counter
S=input()
T=input()
s=list(S)
t=list(T)
a=Counter(s)
b=Counter(t)
c=a.most_common()
d=b.most_common()
flag=True
if d[0][1]>=2 or c[0][1]>=2:
    e=['']*d[0][1]
    f=['']*c[0][1]
    for i in range(len(s)):
        if t[i]==d[0][0]:
            e.append(s[i])
    for i in range(len(e)-1):
        if e[i]!=e[i+1]:
            flag=False
    for i in range(len(s)):
        if s[i]==c[0][0]:
            f.append(t[i])
    for i in range(len(f)-1):
        if f[i]!=f[i+1]:
            flag=False
if flag:
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

Solution code:
from collections import Counter
S=input()
T=input()
s=list(S)
t=list(T)
a=Counter(s)
b=Counter(t)
c=a.most_common()
d=b.most_common()
flag=True
if d[0][1]>=2:
    e=['']*d[0][1]
    for i in range(len(s)):
        if t[i]==d[0][0]:
            e.append(s[i])
    for i in range(len(e)-1):
        if e[i]!=e[i+1]:
            flag=False
if c[0][1]>=2:
    e=['']*c[0][1]
    for i in range(len(s)):
        if s[i]==c[0][0]:
            e.append(t[i])
    for i in range(len(e)-1):
        if e[i]!=e[i+1]:
            flag=False
if flag:
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

Solution code:
from collections import Counter
S=input()
T=input()
s=list(S)
t=list(T)
a=Counter(s)
b=Counter(t)
c=a.most_common()
d=b.most_common()
if d[0][1]>=2:
    e=['']*d[0][1]
    for i in range(len(s)):
        if t[i]==d[0][0]:
            e.append(s[i])
    for i in range(len(e)-1):
        if e[i]!=e[i+1]:
            flag=False
        else:
            flag=True
    if flag:
        print('Yes')
    else:
        print('No')
else:
    print('Yes')

Submission status: Wrong Answer

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


s_idx = []
t_idx = []

def f(S):
    idx = []
    dic = []
    for s in S:
        if s in dic:
            idx.append(dic.index(s))
        else:
            idx.append(len(dic))
            dic.append(s)
    
    return idx

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

print("Yes")

Submission status: Wrong Answer

Solution code:
S = list(str(input()))
T = list(str(input()))
check = 1
SC = [e for e in set(S) if S.count(e) > 1]
TC = [e for e in set(T) if T.count(e) > 1]
if len(SC) != len(TC):
  check = 0
else:
  bij = {}
  for i in range(len(S)):
    if (S[i] not in SC and T[i] in TC) or (S[i] in SC and T[i] not in TC):
      check = 0
      break
    if S[i] in SC and T[i] in TC:
      if S[i] in bij and bij[S[i]] != T[i]:
        check = 0
        break
      elif T[i] in bij and bij[T[i]] != S[i]:
        check = 0
        break
      elif S[i] not in bij and T[i] not in bij:
        bij[S[i]] = T[i]
        bij[T[i]] = S[i]
    
if check:
  print("Yes")
else:
  print("No")

Submission status: Wrong Answer

Solution code:
S = list(str(input()))
T = list(str(input()))
check = 1
SC = [e for e in set(S) if S.count(e) > 1]
TC = [e for e in set(T) if T.count(e) > 1]
if len(SC) != len(TC):
  check = 0
else:
  bij = {}
  for i in range(len(S)):
    if (S[0] not in SC and T[0] in TC) or (S[0] in SC and T[0] not in TC):
      check = 0
      break
    if S[0] in SC and T[0] in TC:
      if S[0] in bij and bij[S[0]] != T[0]:
        check = 0
        break
      elif T[0] in bij and bij[T[0]] != S[0]:
        check = 0
        break
      elif S[0] not in bij and T[0] not in bij:
        bij[S[0]] = T[0]
        bij[T[0]] = S[0]
    
if check:
  print("Yes")
else:
  print("No")

Submission status: Wrong Answer

Solution code:
str2 = input()
str1 = input()
abcd = 'abcdefghijklmnopqrstuvwxyz'
temp = None
for s in abcd:
	temp = None
	for i in range(len(str1)):
		if str1[i] == s:
			if temp != None and temp != str2[i]:
				print('No')
				exit()
			temp = str2[i]
				
print('Yes')

Submission status: Wrong Answer

Solution code:
if True:
    s=input()
    t=input()
else:
    s='abcdefghijklmnopqrstuvwxyz'
    t='ibyhqfrekavclxjstdwgpzmonu'
    s='azzel'
    t='apple'
n=len(s)
az=list('abcdefghijklmnopqrstuvwxyz')
ls=[set() for i in range(26)]
ans='Yes'
di=dict()
#print(ls,s[0],t[0],t,az,az.index('d'))
for i in range(n):
    ls[az.index(t[i])].add(s[i])
    #print(i,ls)
for i in range(26):
    if len(ls[i])>1:
        ans='No'
#print(ls)
print(ans)

Submission status: Wrong Answer

Solution code:
if False:
    s=input()
    t=input()
else:
    s='abcdefghijklmnopqrstuvwxyz'
    t='ibyhqfrekavclxjstdwgpzmonu'
    s='azzel'
    t='apple'
n=len(s)
az=list('abcdefghijklmnopqrstuvwxyz')
ls=[set() for i in range(26)]
ans='Yes'
di=dict()
#print(ls,s[0],t[0],t,az,az.index('d'))
for i in range(n):
    ls[az.index(t[i])].add(s[i])
    #print(i,ls)
for i in range(26):
    if len(ls[i])>1:
        ans='No'
#print(ls)
print(ans)

Submission status: Wrong Answer

Solution code:
if True:
    s=input()
    t=input()
else:
    s='abcdefghijklmnopqrstuvwxyz'
    t='ibyhqfrekavclxjstdwgpzmonu'
n=len(s)
az=list('abcdefghijklmnopqrstuvwxyz')
ls=[set() for i in range(26)]
ans='YES'
di=dict()
#print(ls,s[0],t[0],t,az,az.index('d'))
for i in range(n):
    ls[az.index(t[i])].add(s[i])
    #print(i,ls)
for i in range(26):
    if len(ls[i])>1:
        ans='NO'
#print(ls)
print(ans)

Submission status: Wrong Answer

Solution code:
if True:
    s=input()
    t=input()
else:
    s='abcdefghijklmnopqrstuvwxyz'
    t='ibyhqfrekavclxjstdwgpzmonu'
n=len(s)
az=list('abcdefghijklmnopqrstuvwxyz')
ls=[set() for i in range(26)]
ans='Yes'
di=dict()
#print(ls,s[0],t[0],t,az,az.index('d'))
for i in range(n):
    ls[az.index(s[i])].add(t[i])
    #print(i,ls)
for i in range(26):
    if len(ls[i])>1:
        ans='No'
#print(ls)
print(ans)

Submission status: Wrong Answer

Solution code:
if True:
    s=input()
    t=input()
else:
    s='abcdefghijklmnopqrstuvwxyz'
    t='ibyhqfrekavclxjstdwgpzmonu'
n=len(s)
az=list('abcdefghijklmnopqrstuvwxyz')
ls=[set() for i in range(26)]
ans='YES'
di=dict()
#print(ls,s[0],t[0],t,az,az.index('d'))
for i in range(n):
    ls[az.index(s[i])].add(t[i])
    #print(i,ls)
for i in range(26):
    if len(ls[i])>1:
        ans='NO'
#print(ls)
print(ans)

Submission status: Wrong Answer

Solution code:
import collections as c
s=input()
t=input()
d=c.defaultdict(list)
d2=c.defaultdict(list)
for k,v in enumerate(s):
    d[v].append(k)
for k,v in enumerate(t):
    d2[v].append(k)
if list(d.values())==list(d2.values()):
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

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

d = dict([])
ans = 'Yes'
for i,s in enumerate(S):
    t = T[i]
    try:
        if d[s] != t:
            ans = 'No'
            break
    except:
        d[s] = t

d = dict([])
ans = 'Yes'
for i,t in enumerate(T):
    s = S[i]
    try:
        if d[t] != s:
            ans = 'No'
            break
    except:
        d[t] = s
        
print(ans)

Submission status: Wrong Answer

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

d = dict([])
ans = 'Yes'
for i,s in enumerate(S):
    t = T[i]
    try:
        if d[s] != t:
            print('S',d[s], t)
            ans = 'No'
            break
    except:
        d[s] = t

d = dict([])
ans = 'Yes'
for i,t in enumerate(T):
    s = S[i]
    try:
        if d[t] != s:
            print('T',d[t], s)
            ans = 'No'
            break
    except:
        d[t] = s
        
print(ans)

Submission status: Wrong Answer

Solution code:
from collections import Counter


def main():
    S = input()
    T = input()
    s = set(Counter(S).values())
    t = set(Counter(T).values())

    if s == t:
        print('Yes')
    else:
        x = sorted(list(s ^ t))
        if len(x) > 1 and x[1] != x[0] and x[1] % x[0] == 0:
            print('Yes')
        else:
            print('No')


if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
from collections import Counter


def main():
    S = input()
    T = input()
    s = set(Counter(S).values())
    t = set(Counter(T).values())

    if s == t:
        print('Yes')
    else:
        x = sorted(list(s ^ t))
        if len(x) > 1 and x[1] != x[0] and x[1] % x[0]:
            print('Yes')
        else:
            print('No')


if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
from collections import Counter


def main():
    S = input()
    T = input()
    s = set(Counter(S).values())
    t = set(Counter(T).values())

    if s == t:
        print('Yes')
    else:
        x = sorted(list(s ^ t))
        if len(x) > 1 and x[1] % x[0]:
            print('Yes')
        else:
            print('No')


if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
from collections import Counter


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

    if S == T:
        print('Yes')
    elif set(Counter(S).values()) == set(Counter(T).values()):
        print('Yes')
    else:
        print('No')


if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
from collections import Counter


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

    flg1 = bool
    if set(Counter(S).values()) == set(Counter(T).values()):
        flg1 = True
    else:
        flg1 = False

    flg2 = bool
    if list(Counter(S).values()) == list(Counter(T).values()):
        flg2 = True
    else:
        flg2 = False

    if flg1 or flg2:
        print('Yes')
    else:
        print('No')


if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
from collections import Counter


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

    flg1 = bool
    if set(Counter(S).values()) == set(Counter(T).values()):
        flg1 = True
    else:
        flg1 = False

    flg2 = bool
    if set(Counter(S).values()) == set(Counter(T).values()):
        flg2 = True
    else:
        flg2 = False

    if flg1 or flg2:
        print('Yes')
    else:
        print('No')


if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
from collections import Counter


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

    if set(Counter(S).values()) == set(Counter(T).values()):
        print('Yes')
    else:
        print('No')


if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
from collections import Counter


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

    if list(Counter(S).values()) == list(Counter(T).values()):
        print('Yes')
    else:
        print('No')


if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
ri = lambda: int(input())
rl = lambda: list(map(int,input().split()))
rr = lambda N: [ri() for _ in range(N)]
YN = lambda b: print('YES') if b else print('NO')
yn = lambda b: print('Yes') if b else print('No')
OE = lambda x: print('Odd') if x%2 else print('Even')
INF = 10**18

S=input()
T=input()

dT = dict()
dS = dict()

for i,t in enumerate(T):
    if t not in dT:
        dT[t] = [i]
    else:
        dT[t].append(i)
for i,s in enumerate(S):
    if s not in dS:
        dS[t] = [i]
    else:
        dS[t].append(i)

def ans():
    for c in map(chr,range(ord('a'),ord('z')+1)):
        if c in dT:
            res = S[dT[c][0]]
            for i in dT[c]:
                if res != S[i]:
                    return 0
    for c in map(chr,range(ord('a'),ord('z')+1)):
        if c in dS:
            res = T[dS[c][0]]
            for i in dS[c]:
                if res != T[i]:
                    return 0
    return 1

yn(ans())

Submission status: Wrong Answer

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

ls = [0] * 26
lt = [0] * 26
for s in S:
    ls[ord(s) - 97] += 1
for t in T:
    lt[ord(t) - 97] += 1
if len(set(ls)) == len(set(lt)):
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

for i in range(len(s)):
	if t.count(t[i]) >= 2:
		for j in range(i + 1, len(s)):
			if t[i] == t[j]:
				if s[i] != s[j]:
					print('No')
					exit()
print('Yes')

Submission status: Wrong Answer

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


def f(s):
    l=[]
    a="abcdefghijklmnopqrstuvwxyz"
    r=""
    for i in range(len(s)):
        if s[i] in l:
            for j in range(len(l)):
                r+=a[j]
        else:
            r+=a[len(l)]
            l.append(s[i])
    return r

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

Submission status: Wrong Answer

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


def f(s):
    l=[]
    r=""
    for i in range(len(s)):
        if s[i] in l:
            for j in range(len(l)):
                r+=str(j)
        else:
            r+=str(len(l))
            l.append(s[i])
    return r

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

Submission status: Wrong Answer

Solution code:
s=input()
t=input()
X=[]
Y=[]
ans='Yes'
for i in range(len(s)):
    if s[i]==t[i]:
        continue
    else:
        if t[i] not in s:
            continue
        else:
            X.append(s[i])
            Y.append(t[i])

X.sort()
Y.sort()

if X!=Y:
    ans='No'

print(ans)

Submission status: Wrong Answer

Solution code:
s=input()
t=input()
X=[]
Y=[]
ans='Yes'
for i in range(len(s)):
    if s[i]==t[i]:
        continue
    else:
        if t[i] not in s:
            continue
        else:
            X.append(s[i])
            Y.append(t[i])
            
if set(X)!=set(Y):
    ans='No'

print(ans)

Submission status: Wrong Answer

Solution code:
s=input()
t=input()
ans='Yes'

if set(s)==set(t):
    ans='Yes'
else:
    for i in range(len(s)):
        if s[i]!=t[i] and t[i] in s :
            ans='No'
            break

print(ans)

Submission status: Wrong Answer

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

BASE = ord('a')

flg = True
a = [-1 for _ in range(26)]
for ss, tt in zip(s, t):
    frm = ord(ss) - BASE
    to = ord(tt) - BASE
    if a[frm] == -1:
        a[frm] = to
    else:
        flg = (a[frm] == to)
        if not flg: break

b = list(filter(lambda x: x >= 0, a))
# 変換先が重複していないことを調べる
print('Yes' if len(b) == len(set(b)) else 'No')

Submission status: Wrong Answer

Solution code:
S = input()
T = input()
trans_dict = dict()
flg = 0
for s, t in zip(S, T):
    if s == t:
        continue
    else:
        if trans_dict.get(s) is None:
            trans_dict[s] = t
            S.replace(s, t)
        elif trans_dict.get(s) == t:
            continue
        else:
            flg = 1
            break
if flg == 1:
    print("No")
else:
    print("Yes")

Submission status: Wrong Answer

Solution code:
S = input()
T = input()
def count(lis):
    Ans =[0]*26
    for st in lis:
        Ans[ord(st)-97] += 1
    return Ans

Slist1 = count(S)
Tlist1 = count(T)

def Same(string,List):
    count = 0
    Ans =[0]*len(string)
    for p in string:
        Ans[count] = List[ord(p)-97]
    return Ans
if(Same(S,Slist1)==Same(T,Tlist1)):
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
s = input()
t = input()
if s == t:
	print('Yes')
	exit()
if len(s) == 1:
	if s != t:
		print('No')
		exit()
for i in range(len(t)):
	for j in range(len(t)):
		if t[i] == t[j] and s[i] != s[j]:
			print('No')
			exit()
print('Yes')

Submission status: Wrong Answer

Solution code:
S,T=input(),input()
N=len(S)
link={}

for i in range(N):
    if  T[i] in link:
        if link[T[i]] == S[i]:
            continue
        else:
            print('No')
            exit()
    else:
        link[T[i]]=S[i]
print('Yes')

Submission status: Wrong Answer

Solution code:
S = input()
T = input()
S_list = [i for i in S]
T_list = [i for i in T]
S_set = set(S_list)
T_set = set(T_list)
def judge():
  if len(S_set)==len(T_set)==len(S_list):
    print(len(S_set),len(T_list),len(S_list))
    return "Yes"
  for car in S_set:
    if [j for j, x in enumerate(T_list) if x == T_list[S_list.index(car)]]!=[j for j, x in enumerate(S_list) if x == car]:
      return "No"
  return "Yes"

print(judge())

Submission status: Wrong Answer

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

import re
def findall(string,s):
    return [m.start() for m in re.finditer(s, string)]

from collections import Counter
C = Counter(T).most_common()

ans = 'Yes'

for c in C:
    if c[1] >= 2:
        # import pdb;pdb.set_trace()
        ls = findall(T,c[0])
        s_set = set()
        for num in ls:
            s_set.add(S[num])
        if len(s_set) > 1:
            ans = 'No'
            
print(ans)

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]:
        if not S[i] in dic_s.keys():
            dic_s[S[i]] = T[i]
        if not T[i] in dic_t.keys():
            dic_t[T[i]] = S[i]
        if dic_s[S[i]] != T[i] or dic_t[T[i]] != S[i]:
            print('No')
            break
else:
    print('Yes')

Submission status: Wrong Answer

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

start = [-1] * 26
goal = [-1] * 26
flag = True
length = len(s)
dict = { chr(97 + i):i for i in range(26) }
for i in range(0, length-1):
	a = dict[s[i]]
	b = dict[t[i]]

	if start[a] != -1 or goal[b] != -1:
		if start[a] != b or goal[b] != a:
			flag = False
			break
	else:
		start[a] = b;
		goal[b] = a;
if flag:
	print("Yes")
else:
	print("No")

Submission status: Wrong Answer

Solution code:
import re

s = input()
t = input()

start = [-1] * 26
goal = [-1] * 26
flag = True
length = len(s)
dict = { chr(97 + i):i for i in range(26) }
for i in range(0, length-1):
	a = dict[s[i]]
	b = dict[t[i]]

	if start[a] != -1 or goal[b] != -1:
		if start[a] != b or goal[b] != a:
			flag = False
			break
	start[a] = b;
	goal[b] = a;
if flag:
	print("Yes")
else:
	print("No")

Submission status: Wrong Answer

Solution code:
S=input()
T=input()
al=[chr(ord('a')+i) for i in range(26)]
sameS=[]
sameT=[]

for k in al:
    indexes=[i for i, x in enumerate(S) if x==k]
    sameS.append(indexes)

for k in al:
    indexes=[i for i, x in enumerate(T) if x==k]
    sameT.append(indexes)

if all([x in sameS for x in sameT]) and all([x in sameT for x in sameS]):
    print('Yes')
else:
    print('NO')

Submission status: Wrong Answer

Solution code:
import re

s = input()
t = input()

his = []
length = len(s)
flag = True
for i in range(0, length-1):
	ss = s[i:i+1]
	tt = t[i:i+1]
	if ss != tt:
		if tt in his or ss in his:
			flag = False
			break
		else:
			his.append(tt)
			it1 = re.finditer(ss, s)
			it2 = re.finditer(tt, s)
			for match in it1:
				s = s[:match.start()] + tt + s[match.end():]
			for match in it2:
				s = s[:match.start()] + ss + s[match.end():]
	else:
		his.append(ss)
if flag:
	print("Yes")
else:
	print("No")

Submission status: Wrong Answer

Solution code:
import re
import sys

s = input()
t = input()

his = []
length = len(s)
flag = True
for i in range(0, length-1):
	ss = s[i:i+1]
	tt = t[i:i+1]
	if ss != tt:
		if tt in his:
			flag = False
			break
		else:
			his.append(tt)
			it1 = re.finditer(ss, s)
			it2 = re.finditer(tt, s)
			for match in it1:
				s = s[:match.start()] + tt + s[match.end():]
			for match in it2:
				s = s[:match.start()] + ss + s[match.end():]

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

Submission status: Wrong Answer

Solution code:
s,t = input(),input()
def g(s,t):
    for j in range(len(s)):
        if len(s) == len(t):
            S = [i for i in s if i != s[0] and i != t[0]]
            T = [i for i in t if i != s[0] and i != t[0]]
            s = S
            t = T
        else:
            return 'No'
    return 'Yes'
print(g(s,t))

Submission status: Wrong Answer

Solution code:
# https://qiita.com/_-_-_-_-_/items/34f933adc7be875e61d0
# abcde	s=input()	s='abcde'
# abcde	s=list(input())	s=['a', 'b', 'c', 'd', 'e']
# 5(1つだけ)	a=int(input())	a=5
# 1 2	| x,y = map(int,input().split())   |	x=1,y=2
# 1 2 3 4 5 ... n 　	li = input().split()	li=['1','2','3',...,'n']
# 1 2 3 4 5 ... n 　	li = list(map(int,input().split()))	li=[1,2,3,4,5,...,n]
# FFFTFTTFF 　	li = input().split('T')	li=['FFF', 'F', '', 'FF']

# INPUT
# 3
# hoge
# foo
# bar
# ANSWER
# n=int(input())
# string_list=[input() for i in range(n)]


from collections import defaultdict, Counter
import math
from bisect import bisect_left, bisect_right
import numpy as np

s = input()
t = input()

s_dic = dict()
t_dic = dict()

flag = True
for i in range(len(s)):
    s_i = s[i]
    t_i = t[i]
    if s_i not in s_dic:
        s_dic[s_i] = t_i
    if t_i not in t_dic:
        t_dic[t_i] = s_i
    else:
        if s_dic[s_i] != t_i or t_dic[t_i] != s_i:
            flag = False

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

Submission status: Wrong Answer

Solution code:
# https://qiita.com/_-_-_-_-_/items/34f933adc7be875e61d0
# abcde	s=input()	s='abcde'
# abcde	s=list(input())	s=['a', 'b', 'c', 'd', 'e']
# 5(1つだけ)	a=int(input())	a=5
# 1 2	| x,y = map(int,input().split())   |	x=1,y=2
# 1 2 3 4 5 ... n 　	li = input().split()	li=['1','2','3',...,'n']
# 1 2 3 4 5 ... n 　	li = list(map(int,input().split()))	li=[1,2,3,4,5,...,n]
# FFFTFTTFF 　	li = input().split('T')	li=['FFF', 'F', '', 'FF']

# INPUT
# 3
# hoge
# foo
# bar
# ANSWER
# n=int(input())
# string_list=[input() for i in range(n)]


from collections import defaultdict, Counter
import math
from bisect import bisect_left, bisect_right
import numpy as np

s = input()
t = input()

s_dic = dict()
t_dic = dict()
flag = True
for i in range(len(s)):
    s_i = s[i]
    t_i = t[i]
    if s_i == t_i:
        continue
    if s_i not in s_dic and t_i not in t_dic:
        s_dic[s_i] = t_i
        t_dic[t_i] = s_i
        s = s.replace(s_i, s_dic[s_i])
        t = t.replace(s_i, t_dic[t_i])
        i = 0
    else:
        flag = False
        break

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

Submission status: Wrong Answer

Solution code:
s = input()
t = input()
s_list = []
t_list = []

for i in range(26):
    s_list.append(s.count(chr(97+i)))
    t_list.append(t.count(chr(97+i)))

s_list.sort()
t_list.sort()
true = 0
for i in range(26):
    if s_list[i] != t_list[i]:
        print('no')
        break
    else:
        true += 1
if true == 26:
    print('yes')

Submission status: Wrong Answer

Solution code:
from collections import Counter
if list(Counter(input()).values()) == list(Counter(input()).values()):
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

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

sc = ["" for i in range(0, 26)]
tc = ["" for i in range(0, 26)]
scf = False
tcf = False
for i in range(0, len(s)):
    sci = sc[ord(s[i]) - ord('a')]
    if sci != "" and t[i] != sci:
        print("No")
        scf = True
        break
    else:
        sc[ord(s[i]) - ord('a')] = t[i]

if not scf:
    for i in range(0, len(t)):
        tci = tc[ord(t[i]) - ord('a')]
        if tci != "":
            if t[i] == tci or t[i] == s[i]:
                print("No")
                tcf = True
                break
        else:
            tc[ord(t[i]) - ord('a')] = s[i]

    if not tcf:
        print("Yes")