Problem:


Score : 300 points

Problem Statement

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

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

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

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

Constraints

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

|S| = |T|

S and T consists of lowercase English letters.

Input

Input is given from Standard Input in the following format:

S
T

Output

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

Sample Input 1

azzel
apple

Sample Output 1

Yes

azzel can be changed to apple, as follows:

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

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

Sample Input 2

chokudai
redcoder

Sample Output 2

No

No sequences of operation can change chokudai to redcoder.

Sample Input 3

abcdefghijklmnopqrstuvwxyz
ibyhqfrekavclxjstdwgpzmonu

Sample Output 3

Yes



Sample input:
azzel
apple


Sample output:
Yes

Submission status: Wrong Answer

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

for i in range(len(S)):
    if (T[i] == S[i])or(T[i] == 0):
        continue
    else:
        for j in range(T.count(T[i])):
            x = T.index(T[i])
            if S[x] == S[i]:
                T[x] = 0
                continue
            else:
                print("No")
                exit()

print("Yes")

Submission status: Wrong Answer

Solution code:
S = input()
T = input()
for i in range(len(S)):
    kensa1 = [index for index, word in enumerate(S) if S[i] == word]
    kensa2 = [index for index, word in enumerate(S) if T[i] == word]
    if kensa1 != kensa2:
        print('No')
        break
else:
    print('Yes')

Submission status: Wrong Answer

Solution code:
s = input()
t = input()
i = 0
flag = True
d = dict()
for i in range(len(s)):
    
#    if s[i] in d:
#        if d[s[i]] != t[i]:
#            flag = False
#    elif s[i] in d.values():
#        keys = [k for k, v in d.items() if v == s[i]]
#        if not t[i] in keys:
#            flag = False
#    else:
#        d[s[i]] = t[i]
    if s[i] == t[i]:
        continue
    else:
        s.translate(str.maketrans({s[i]: t[i]}))
        s.translate(str.maketrans({t[i]: s[i]}))
        
if s == t:
    flag =True
else:
    flag = False
if flag:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
s = input()
t = input()
i = 0
flag = True
d = dict()
for i in range(len(s)):
    
#    if s[i] in d:
#        if d[s[i]] != t[i]:
#            flag = False
#    elif s[i] in d.values():
#        keys = [k for k, v in d.items() if v == s[i]]
#        if not t[i] in keys:
#            flag = False
#    else:
#        d[s[i]] = t[i]
    if s[i] == t[i]:
        continue
    else:
        s.translate(str.maketrans({s[i]: t[i]}))
if s == t:
    flag =True
else:
    flag = False
if flag:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
s=input()
t=input()
flag=0
alp=[chr(ord('a') + i) for i in range(26)]
for c in alp:
  if flag==1:
    break
  target = c
  index = -1
  indexes=[]
  while True:
    index = t.find(target, index + 1)
    if index == -1:
      break
    indexes.append(index)
  if len(indexes)>1:
    a=s[indexes[0]]
    for i in indexes:
      if a!=s[i]:
        flag=1
        break
if flag==1:
  print("No")
else:
  print("Yes")

Submission status: Wrong Answer

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

c = {}
for i in range(len(S)):
    try:
        if c[S[i]] != T[i]:
            print('No')
            exit()
    except:
        c[S[i]] = T[i]

if len(c.values()) != len(set(c.values())):
    print('NO')
    exit()
print('Yes')

Submission status: Wrong Answer

Solution code:
def solve():
    alpha = "abcdefghijklmnopqrstuvwxyz"
    inp1, inp2 = input(), input()
    sz = dict(zip(list(alpha), [0] * 26))
    tz = dict(zip(list(alpha), [0] * 26))
    siz = dict(zip(list(alpha), [[] for _ in range(26)]))
    tiz = dict(zip(list(alpha), [[] for _ in range(26)]))
    for i in range(len(inp1)):
        sz[inp1[i]] += 1
        tz[inp2[i]] += 1
        siz[inp1[i]].append(i)
        tiz[inp2[i]].append(i)
        if (sz[inp1[i]] != tz[inp2[i]]
                or set(siz[inp1[i]]) != tiz[inp2[i]]):
            print("No")
            return
    print("Yes")


solve()

Submission status: Wrong Answer

Solution code:
def solve():
  from collections import Counter
  s = [i for i in sorted(Counter(input()).values())]
  t = [i for i in sorted(Counter(input()).values())]
  print(["No","YES"][s==t])

solve()

Submission status: Wrong Answer

Solution code:
import collections

if __name__ == '__main__':
    s = list(input())
    t = list(input())
    l = ['0' for i in range(26)]
    result = True

    for i in range(len(s)):
        if s[i] != t[i]:
            l[ord(s[i]) - ord('a')] = t[i]
    #print('l=', l)
    c = collections.Counter(l)
    #print(c)

    for str in c.most_common():
        #print(str)
        if str[0] != '0' and str[1] > 1:
            #print(str[0])
            print('No')
            result = False
            break
    if result:
        print('Yes')

Submission status: Wrong Answer

Solution code:
from string import ascii_lowercase

s = input()
t = input()
dic = {}
for c in ascii_lowercase:
    dic[c] = None

for ss, tt in zip(s, t):
    if dic[tt] is None:
        dic[tt] = ss
    elif dic[tt] != ss:
        print('No')
        exit()
else:
    print('Yes')

Submission status: Wrong Answer

Solution code:
#AtCorder Beginner Context 110 C String Transformation

import collections

#入力を1文字ずつリストにして変数に格納
s = list(input())
t = list(input())

cs = collections.Counter(s)
ct = collections.Counter(t)
slist = list(cs.values())
tlist = list(ct.values())

if len(slist) != len(tlist) or slist.sort() != tlist.sort():
    print("No")
else:
    print("Yes")

Submission status: Wrong Answer

Solution code:

s= input()
t = input()

def solve(s,t):
    char_map = {}
    for i in range(len(t)):
        if t[i] in char_map:
            char_map[t[i]].add(s[i])
        else:
            char_map[t[i]] = set(s[i])
    
    for i in char_map:
        if len(char_map[i]) != 1:
            return False
    return True

if solve(s,t):
    print("Yes") 
else:
    print("No")

Submission status: Wrong Answer

Solution code:
s = list(input())
t = list(input())
s = list(set(s))
t = list(set(t))
s.sort()
t.sort()
diff = []

if len(s) == len(t):
    for i in range(len(s)):
        if s[i] == t[i]:
            pass
        else:
            diff.append(s[i])
            diff.append(t[i])
    if len(set(diff)) % 2 == 0:
        print("Yes")
    else:
        print("No")
        exit()
else:
    print("No")

Submission status: Wrong Answer

Solution code:
s = list(input())
t = list(input())
s = list(set(s))
t = list(set(t))
s.sort()
t.sort()
diff = []

if len(s) == len(t):
    for i in range(len(s)):
        if s[i] == t[i]:
            pass
        else:
            diff.append(s[i])
            diff.append(t[i])
    if len(diff) % 2 == 0:
        pass
    else:
        print("No")
        exit()

    print("Yes")

else:
    print("No")

Submission status: Wrong Answer

Solution code:
s = list(input())
t = list(input())
s = list(set(s))
t = list(set(t))
s.sort()
t.sort()
diff = []

if len(s) == len(t):
    for i in range(len(s)):
        if s[i] == t[i]:
            pass
        else:
            diff.append(s[i])
            diff.append(t[i])
            if len(set(diff)) == len(diff):
                pass
            else:
                print("No")
                exit()

    print("Yes")

else:
    print("No")

Submission status: Wrong Answer

Solution code:
s = list(input())
t = list(input())
s = list(set(s))
t = list(set(t))
if len(s) == len(t):
    for i in range(len(s)):
        if s[i] == t[i]:
            print("No")
            exit()
        else:
            print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
S = input()
T = input()
 
S_list = []
T_list = []
alpha = "abcdefghijklmnopqrstuvwxyz"
 
for i in alpha:
    SS = S.count(i)
    TT = T.count(i)
    if SS and TT > 0:
        S_list.append(SS)
        T_list.append(TT)
 
if sorted(S_list) != sorted(T_list):
    print('No')
else:
    print('Yes')

Submission status: Wrong Answer

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

S_list = []
T_list = []
print(S_list)
print(T_list)
alpha = "abcdefghijklmnopqrstuvwxyz"

for i in alpha:
    SS = S.count(i)
    TT = T.count(i)
    if SS > 0:
        S_list.append(SS)
    if TT > 0:
        T_list.append(TT)

if sorted(S_list) != sorted(T_list):
    print('No')
else:
    print('Yes')

Submission status: Wrong Answer

Solution code:
S = raw_input().lower()
T = raw_input().lower()
Sl = list(S)
Tl = list(T)
dif = {}
Sc = []
for n in range(len(S)):
    if S[n] != T[n]:
        dif[S[n]] = (T[n])
for n, s in enumerate(Sl):
    if s != Tl[n]:
        Sc.append(dif.get(s))
    else:
        Sc.append(s)
Scs = ('').join(Sc)
if Scs == T:
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

Solution code:
S = input()
T = input()
alphabets = "abcdefghijklmnopqrstuvwxyz"

S_list=[]
T_list=[]
for c in alphabets:
    Scnt = S.count(c)
    Tcnt = T.count(c)
    if Scnt > 0:
        S_list.append(Scnt)
    if Tcnt > 0:
        T_list.append(Tcnt)

if sorted(S_list) is sorted(T_list):
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

Solution code:
s = list(input())
t = list(input())
s.sort()
t.sort()
s = list(set(s))
t = list(set(t))
if len(s) == len(t):
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

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

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

s.sort()
t.sort()

v = 0
w = 0

a = [0 for i in range(0,n)]
b = [0 for i in range(0,n)]

c = [0 for i in range(0,26)]
d = [0 for i in range(0,26)]

for i in range(0,n-1):
    if s[i] == s[i+1]:
        a[i+1] = v
    else:
        v += 1
        a[i + 1] = v

for i in range(0,n-1):
    if t[i] == t[i+1]:
        b[i+1] = w
    else:
        w += 1
        b[i + 1] = w

for i in range(0,26):
    c[i] = a.count(i)

for i in range(0,26):
    d[i] = b.count(i)

if c == d:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
# coding: utf-8
import string

s = input().split()
t = input().split()
s = list(s[0])
t = list(t[0])

alpha = list(string.ascii_lowercase)

cnt_s = []
cnt_t = []
for c in alpha:
    cnt_s = cnt_s + [0]
    cnt_t = cnt_t + [0]

cnt = 0
for c in alpha:
    for c_s in s:
        if c_s == c:
            cnt_s[cnt] = cnt_s[cnt] + 1
    for c_t in t:
        if c_t == c:
            cnt_t[cnt] = cnt_t[cnt] + 1
    cnt+=1

cnt = 0
flag = "Yes"
for i in range(len(alpha)):
    if not( cnt_s[i] == 0 or cnt_t[i] == 0 or cnt_s[i] == cnt_t[i] ):
        flag = "No"

print(flag)

Submission status: Wrong Answer

Solution code:
# coding: utf-8
import string

s = input().split()
t = input().split()
s = list(s[0])
t = list(t[0])

alpha = list(string.ascii_lowercase)

cnt_s = []
cnt_t = []
for c in alpha:
    cnt_s = cnt_s + [0]
    cnt_t = cnt_t + [0]

cnt = 0
for c in alpha:
    for c_s in s:
        if c_s == c:
            cnt_s[cnt] = cnt_s[cnt] + 1
    for c_t in t:
        if c_t == c:
            cnt_t[cnt] = cnt_t[cnt] + 1
    cnt+=1

cnt = 0
flag = 0
for i in range(len(alpha)):
    if not( cnt_s[i] == 0 or cnt_t[i] == 0 or cnt_s[i] == cnt_t[i]):
        flag = 1

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

Submission status: Wrong Answer

Solution code:
def uni(t, l):
    if len(l) < 2:
        return True
    else:
        for i in range(1, len(l)):
            if t[l[0]] != t[l[i]]:
                return False
            else:
                pass
        return True

s = input()
t = input()

l = 'abcdefghijklmnopqrstuvwxyz'

flag = True

for x in l:
    tmp = []
    for i,y in enumerate(t):
        if y == x:
            tmp.append(i)
#    print(x)
#    print(tmp)
    if not uni(s, tmp):
        flag = False

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

Submission status: Wrong Answer

Solution code:
# coding: utf-8
import string

s = input().split()
t = input().split()
s = list(s[0])
t = list(t[0])

alpha = list(string.ascii_lowercase)

cnt_s = []
cnt_t = []
for c in alpha:
    cnt_s = cnt_s + [0]
    cnt_t = cnt_t + [0]

cnt = 0
for c in alpha:
    for c_s in s:
        if c_s == c:
            cnt_s[cnt] = cnt_s[cnt] + 1
    for c_t in t:
        if c_t == c:
            cnt_t[cnt] = cnt_t[cnt] + 1
    cnt+=1

cnt = 0
flag = 0
for i in range(len(alpha)):
    if not( (cnt_s[i] == 0 and cnt_t[i] == 0) or cnt_s[i] == cnt_t[i]):
        flag = 1

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

Submission status: Wrong Answer

Solution code:
# coding: utf-8
import string

s = input().split()
t = input().split()
s = list(s[0])
t = list(t[0])

alpha = list(string.ascii_lowercase)

cnt_s = []
cnt_t = []
for c in alpha:
    cnt_s = cnt_s + [0]
    cnt_t = cnt_t + [0]

cnt = 0
for c in alpha:
    for c_s in s:
        if c_s == c:
            cnt_s[cnt] = cnt_s[cnt] + 1
    for c_t in t:
        if c_t == c:
            cnt_t[cnt] = cnt_t[cnt] + 1
    cnt+=1

cnt = 0
flag = 0
for i in range(len(alpha)):
    if not(cnt_s[i] == 0 or cnt_t[i] == 0 or cnt_s[i] == cnt_t[i]):
        flag = 1

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

Submission status: Wrong Answer

Solution code:
# coding: utf-8
import string

s = input().split()
t = input().split()

s = list(s[0])
t = list(t[0])

alpha = list(string.ascii_lowercase)

cnt_s = []
cnt_t = []

for c in alpha:
    cnt_s = cnt_s + [0]
    cnt_t = cnt_t + [0]

cnt = 0
for c in alpha:
    for c_s in s:
        if c_s == c:
            cnt_s[cnt] = cnt_s[cnt] + 1
    for c_t in t:
        if c_t == c:
            cnt_t[cnt] = cnt_t[cnt] + 1
    cnt+=1

cnt = 0
flag = 0
for i in range(len(alpha)):
    if not(cnt_s[i] == 0 or cnt_t[i] == 0 or cnt_s[i] == cnt_t[i]):
        flag = 1

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

Submission status: Wrong Answer

Solution code:
import sys

S = input()
T = input()

len_S = len(S)
S_Converted = S
for i in range (len(S)):
    tmp_S = S_Converted[i]
    tmp_T = T[i]
    if tmp_S == tmp_T:
        continue
    S_Converted = list(S_Converted) 
    list_indexT = [j for j, tmp_SC in enumerate(S_Converted) if tmp_SC == tmp_T]
    if (not list_indexT == []) and (list_indexT[0] < i):
        print('No')
        sys.exit()
    S_Converted = ''.join(S_Converted)
    S_Converted = S_Converted.replace(tmp_S, tmp_T)
    S_Converted = list(S_Converted) 
    for li in list_indexT:
        if li == i:
            continue
        else:
            S_Converted[li] = tmp_S
    print(''.join(S_Converted))
    
S_Converted = ''.join(S_Converted)

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

Submission status: Wrong Answer

Solution code:
a=input()
b=input()
B=b
for i in range(len(a)):
  B=B.replace(B[i],a[i].upper())
if a==b:
  print('Yes')
elif len(set(list(a)))==26:
  print('No')
elif a.upper()==B:
  print('Yes')
else:
  print('No')

Submission status: Wrong Answer

Solution code:
from collections import Counter

S = input()
T = input()

counter_S = Counter(S)
counter_T = Counter(T)

if list(counter_S.values()) == list(counter_T.values()):
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
n = input()
m = input()

_dict = {chr(x): [] for x in range(97, 97+26)}

for i, j in zip(n, m):
    _dict[i].append(j)
    _dict[j].append(i)

res = "Yes"
for j in _dict.values():
    if len(set(j)) != 1 and len(set(j)) != 0:
        res = "No"
        break
print(res)

Submission status: Wrong Answer

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

flag = True
translate1 = [-1 for i in range(26)]
translate2 = [-1 for i in range(26)]
for i in range(len(S)):
    s = ord(S[i])-97
    t = ord(T[i])-97

    if translate1[s] == -1:
        translate1[s] = t
    else:
        if translate1[s] != t:
            flag = False
            break 

    if translate2[t] == -1:
        translate2[t] = s
    else:
        if translate2[t] != s:
            flag = False
            break


if flag:
    print('YES')
else:
    print('NO')

Submission status: Wrong Answer

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

flag = True
translate = [-1 for i in range(26)]

for i in range(len(S)):
    s = ord(S[i])-97
    if translate[s] == -1:
        translate[s] = ord(T[i])
    else:
        if ord(T[i]) != translate[s]:
            flag = False
            break


if flag:
    print('YES')
else:
    print('NO')

Submission status: Wrong Answer

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

sorted_t = list(set(sorted(t)))

for i in sorted_t:
    check = 0
    temp = 'a'
    for j in range(len(t)):
        if t[j] == i:
            if check == 0:
                check = 1
                temp = s[j]
            elif s[j] != temp:
                print('No')
                exit()

print('Yes')

Submission status: Wrong Answer

Solution code:
from sys import stdin

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

    s = list(S)
    t = list(T)
    lst = set()
    for i, si in enumerate(s):
        if si in lst:
            s[i] = 1
        else:
            s[i] = 0
        lst.add(si)

    lst.clear()
    for i, ti in enumerate(t):
        if ti in lst:
            t[i] = 1
        else:
            t[i] = 0
        lst.add(ti)

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

input = lambda: stdin.readline().rstrip()
main()

Submission status: Wrong Answer

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

lens = len(S)
S = S
dic1,dic2 = {},{}
for i in range(lens):
    dic1[S[i]] = T[i]
    dic2[T[i]] = S[i]

ch = 0
for k1 in dic1.keys():
#    print(k1, '->', dic2[dic1[k1]])
    if dic2[dic1[k1]] != k1:
        ch = 1

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

Submission status: Wrong Answer

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

ST = set(zip(S, T))
X = len(S) == len(T) == len(ST)

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

Submission status: Wrong Answer

Solution code:
S = len(set(input()))
T = len(set(input()))
print('Yes' if S == T else 'No')

Submission status: Wrong Answer

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


from collections import defaultdict
s = defaultdict(int)
t = defaultdict(int)


for i in S:
	s[i] += 1

for j in T:
	t[j] += 1
	
ss = sorted(s.values())
tt = sorted(t.values())

print(ss,tt)

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

Submission status: Wrong Answer

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

def count_string(strInput):
    tmp = []
    b = strInput[0]
    cnt = 0
    for s in strInput:
        if b != s:
            tmp.append(cnt)
            cnt = 1
        else:
            cnt += 1
        b = s
    tmp.append(cnt)
    
    return tmp

S_count = count_string(S)
T_count = count_string(T)

if S_count == T_count:
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

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

def count_string(strInput):
    tmp = []
    b = strInput[0]
    cnt = 0
    for s in strInput:
        if b != s:
            tmp.append(cnt)
            cnt = 1
        else:
            cnt += 1
    tmp.append(cnt)
    
    return tmp

S_count = count_string(S)
T_count = count_string(T)

if S_count == T_count:
    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={}
result=[]
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)

#print(p)
#print(z)

w=[]
for k,v in z.items():
    if len(v)>1:
        w.append(v)
o=[]
for k,v in p.items():
    if len(v)>1:
        o.append(v)
#print(w)
#print(o)
"""
for i in w:
    if i not in o:
        print("No")
        sys.exit()
for i in o:
    if i not in w:
        print("No")
        sys.exit()
print("Yes")"""
"""


for k,v in z.items():
    if len(v)>1:
        temp=0
        for k1, v1 in p.items():
            if p[k1]==z[k]:
                temp=1
"""




print("Yes") if w==o else print("No")

Submission status: Wrong Answer

Solution code:
import sys
from collections import Counter
one=list(input())
#print(one)
two=list(input())
z={}
result=[]
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)

#print(p)
#print(z)

w=[]
for k,v in z.items():
    if len(v)>1:
        w.append(v)
o=[]
for k,v in p.items():
    if len(v)>1:
        o.append(v)
#print(w)
#print(o)
"""
for i in w:
    if i not in o:
        print("No")
        sys.exit()
for i in o:
    if i not in w:
        print("No")
        sys.exit()
print("Yes")"""
"""


for k,v in z.items():
    if len(v)>1:
        temp=0
        for k1, v1 in p.items():
            if p[k1]==z[k]:
                temp=1
"""




print("Yes") if w==o else print("No")

Submission status: Wrong Answer

Solution code:
import sys
from collections import Counter
one=list(input())
#print(one)
two=list(input())
z={}
result=[]
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)

#print(p)
#print(z)

w=[]
for k,v in z.items():
    if len(v)>1:
        w.append(v)
o=[]
for k,v in p.items():
    if len(v)>1:
        o.append(v)
#print(w)
#print(o)
for i in w:
    if i not in o:
        print("No")
        sys.exit()
print("Yes")

Submission status: Wrong Answer

Solution code:
import sys
from collections import Counter
one=list(input())
#print(one)
two=list(input())
z={}
result=[]
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)

#print(p)
#print(z)

w=[]
for k,v in z.items():
    if len(v)>1:
        result.append(v)
o=[]
for k,v in p.items():
    if len(v)>1:
        o.append(v)
#print(w)
#print(o)
for i in w:
    if i not in o:
        print("No")
        sys.exit()
print("Yes")

Submission status: Wrong Answer

Solution code:
import sys
from collections import Counter
one=list(input())
#print(one)
two=list(input())
z={}
result=[]
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)

print(p)
print(z)

w=[]
for k,v in z.items():
    if len(v)>1:
        result.append(v)
o=[]
for k,v in p.items():
    if len(v)>1:
        o.append(v)
print(w)
print(o)
for i in w:
    if i not in o:
        print("No")
        sys.exit()
print("Yes")

Submission status: Wrong Answer

Solution code:
from collections import Counter

s = input()
t = input()

ds = Counter(list(s))
ts = Counter(list(t))

sl = [i for i in ds.values()]
tl = [j for j in ts.values()]

print('Yes') if(sl.sort() == tl.sort()) else print('No')


# print('Yes') if(sorted(ds.values()) == sorted(ts.values())) else print('No')

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=[]
#print(p)
#print(z)
for k,v in z.items():
    if len(v)>1:
        w.append(v)
o=[]
for k,v in p.items():
    if len(v)>1:
        o.append(v)
#print(w)
#print(o)


print("Yes") if w==o else print("No")

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=[]
print(p)
print(z)
for k,v in z.items():
    if len(v)>1:
        w.append(v)
o=[]
for k,v in p.items():
    if len(v)>1:
        o.append(v)
#print(w)
#print(o)


print("Yes") if w==o else print("No")

Submission status: Wrong Answer

Solution code:
s=list(input())
t=list(input())
rs=[-1 for i in range(len(s))]
rt=[-1 for i in range(len(t))]
ans='?'
for i in range(len(s)):
    if s[i]!=t[i]:
        if rs[i]>=0:
            if rs[i]!=t[i]:
                ans='No'
                break
        if rt[i]>=0: 
            if rt[i]!=s[i]:
                ans='No'
                break
        if rs[i]<0:
            rs[i]=t[i]
        if rt[i]<0:
            rt[i]=s[i]
else:
    ans='Yes'
print(ans)

Submission status: Wrong Answer

Solution code:
s=list(input())
t=list(input())
rs=[-1 for i in range(len(s))]
rt=[-1 for i in range(len(t))]
ans='?'
for i in range(len(s)):
    if rs[i]>=0:
        if rs[i]!=t[i]:
            ans='No'
            break
    if rt[i]>=0: 
        if rt[i]!=s[i]:
            ans='No'
            break
    if rs[i]<0:
        rs[i]=t[i]
    if rt[i]<0:
        rt[i]=s[i]
else:
    ans='Yes'
print(ans)

Submission status: Wrong Answer

Solution code:
from collections import Counter
import sys

s = input()
t = input()

ds = Counter(list(s))
ts = Counter(list(t))

sl = [v for v in ds.values()]
tl = [v for v in ts.values()]

if(len(s) != len(t)):
    print('No')
    sys.exit()
else:
    for i,j in zip(sl, tl):
        if(i != j):
            print('No')
            sys.exit()
        else:
            pass

print('Yes')

Submission status: Wrong Answer

Solution code:
from collections import Counter
import sys

s = input()
t = input()

ds = Counter(list(s))
ts = Counter(list(t))

sl = [v for v in ds.values()]
tl = [v for v in ts.values()]

if(len(sl) != len(tl)):
    print('No')
    sys.exit()
else:
    for i,j in zip(sl, tl):
        if(i != j):
            print('No')
            sys.exit()
        else:
            pass

print('Yes')

Submission status: Wrong Answer

Solution code:
a=input()
b=input()

while (1):
    if a=='':
        break
    a=a.replace(a[0],'')
    b=b.replace(b[0],'')
    print(a,b)
    

    if len(a)!=len(b):
        print('No')
        exit()

print('Yes')

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=[]
#print(p)
#print(z)
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:
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=[]
print(p)
print(z)
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 main():
    data0 = input()
    data1 = input()

    flag = True
    data_tmp = data0
    count = 0
    len_data = len(data0)
    while True:
        if data0 == "":
            break
        c,d=data0[0],data1[0]
        data0 = data0.replace(data0[0], "")
        data0 = data0.replace(data1[0], "")
        data1 = data1.replace(data1[0], "")
        data1 = data1.replace(c, "")
        if len(data0) != len(data1):
            print('No')
            exit()

    print('Yes')

if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
S = input()
T = input()
ans ='Yes'
d = {}
d2 = {}
for i, (s, t) in enumerate(zip(S, T)):
    if s == t:
        continue
    if d.get(s) is not None:
        if d.get(s) != t:
            ans = 'No'
            break
    else:
        d[s] = t

    if d2.get(t) is not None:
        if d2.get(t) != s:
            ans = 'No'
            break
    else:
        d2[t] = s

print(ans)

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
from sys import stdin
import re

s_in = lambda: stdin.readline()[:-1] # s = s_in()
d_in = lambda: int(stdin.readline()) # N = d_in()
ds_in = lambda: list(map(int, stdin.readline().split())) # List = ds_in()

S = s_in()
T = s_in()
N = len(S)

rec = []
idxes = [i for i in range(26)]

def alpnum(s):
    return ord(s) - ord('a')

for i in range(N):
    si = alpnum(S[i])
    ti = alpnum(T[i])
    if (idxes[si] != ti):
        idx = idxes.index(ti)
        idxes[si], idxes[idx] = idxes[idx], idxes[si]
        if (idxes[si] in rec) or (ti in rec):
            print('No')
            exit()
    rec.append(ti)
print('Yes')

Submission status: Wrong Answer

Solution code:
from collections import Counter

S = Counter(list(input()))
T = Counter(list(input()))
s,t = list(S.values()).sort(), list(T.values()).sort()
print(["No", "Yes"][s == t])

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
from sys import stdin
import re

s_in = lambda: stdin.readline()[:-1] # s = s_in()
d_in = lambda: int(stdin.readline()) # N = d_in()
ds_in = lambda: list(map(int, stdin.readline().split())) # List = ds_in()

S = s_in()
T = s_in()
N = len(S)

rec = []
for i in range(N):
    if (S[i] != T[i]):
        S = re.sub(S[i], T[i], S) 
        if S[i] in rec:
            print('No')
            exit()
    rec.append(T[i])
print('Yes')

Submission status: Wrong Answer

Solution code:
import sys

S = input()
T = input()

r_dic = {}
for i in range(len(S)):
    s = S[i]
    t = T[i]
    # print(s, t)
    # print(r_dic, s in r_dic)

    if(t in r_dic):
        if(r_dic[t] != s):
            print("No")
            sys.exit()
    else:
        r_dic[t] = s

print("Yes")

Submission status: Wrong Answer

Solution code:
S = input()
T = input()
A = [-1]*26
B = [-1]*26
L = len(S)
ans = 'Yes'
for i in range(L):
    ords = ord(S[i])-97
    ordt = ord(T[i])-97
    if A[ords] == -1 and B[ords] == -1:
        A[ords] = ordt
        B[ordt] = ords
    elif A[ords] == ordt and B[ordt] == ords:
        continue
    else:
        ans = 'No'
print(ans)

Submission status: Wrong Answer

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

slist=[]
tlist=[]

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

print('Yes')

Submission status: Wrong Answer

Solution code:
ss = input().strip()
ts = input().strip()

mapping = {}
for s, t in zip(ss, ts):
  if mapping.get(s, t) != t:
    print("No")
    quit(0)
  mapping[s] = t
print("Yes")

Submission status: Wrong Answer

Solution code:
S = input()
T = input()
ans ='Yes'
d = {}
for i, (s, t) in enumerate(zip(S, T)):
    if s == t:
        continue
    if d.get(s) is not None or d.get(t) is not None:
        if d.get(s) != t or d.get(t) != s:
            ans = 'No'
            break
    d[s] = t
    d[t] = s
    
print(ans)