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:
ss = str(input())
t  = str(input())
s  = list(ss)

for i in range(len(s)):

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

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

        idxs = []
        idx = -1
        
        for j in range(len(s)):
            if s[j] == c1:
                s[j] = c2
            elif s[j] == c2:
                s[j] = c1        
        
        ss = "".join(s)
print("No")

Submission status: Wrong Answer

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

s = list(ss)
r = []

for i in range(len(s)):

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

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

        idxs = []
        idx = -1
        while True:
            idx = ss.find(c1,idx+1)
            if idx < 0 :
                break
            idxs.append(idx)

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

Submission status: Wrong Answer

Solution code:
from collections import defaultdict
import string


S = input()
T = input()

sd = defaultdict(set)
for i, s in enumerate(T):
    sd[s].add(i)

for c in sd.keys():
    index = sd[c]
    s = set()
    for i in index:
        s.add(S[i])
    if len(s) != 1:
        print("No")
        exit()
print("Yes")

Submission status: Wrong Answer

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

cemetery = []
for i in range(len(S)):
    if S[i] in cemetery:
        continue
    
    for j in range(i+1, len(S)):
        if S[j] == S[i]:
            if T[j] != T[j]:
                result = False
                break
        elif T[j] == T[i]:
            result = False
            break

    if not result:
        break

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

Submission status: Wrong Answer

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

s = set(S)
t = set(T)

if len(s) - len(s.intersection(t)) <=1:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
import numpy as np

s=input()
t=input()
s_cnt=np.zeros(26)
s_letterPlace=[[] for _ in range(26)]
for i,si in enumerate(s):
    num=ord(si)-ord('a')
    s_cnt[num]+=1
    s_letterPlace[num].append(i)

s_multiLetter=[]
for cnt,place in zip(s_cnt,s_letterPlace):
    if cnt>1:
        s_multiLetter.append(place)

t_cnt=np.zeros(26)
t_letterPlace=[[] for _ in range(26)]
for i,ti in enumerate(t):
    num=ord(ti)-ord('a')
    t_cnt[num]+=1
    t_letterPlace[num].append(i)

t_multiLetter=[]
for cnt,place in zip(t_cnt,t_letterPlace):
    if cnt>1:
        t_multiLetter.append(place)
print(len(s_multiLetter))
print(len(t_multiLetter))

flag=1
if len(s_multiLetter)!=len(t_multiLetter):
    flag=0
else:
    for s_place in s_multiLetter:
        if(flag==1):
            for t_place in t_multiLetter:
                if(s_place==t_place):
                    flag=1
                    break
                else:
                    flag=0

print('Yes' if flag==1 else 'No')

Submission status: Wrong Answer

Solution code:
S=input()
T=input()
s=set(list(S))
t=set(list(T))
if (len(s)-len(t))%2==0:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
def m():
    s = input()
    t = input()
    d = {}
    n = len(s)
    for i in range(n):
        if d.get(t[i],0):
            if d[t[i]] == t[i]:
                continue
            if d[t[i]] != s[i]:
                return 'No'
        else:
            d[t[i]] = s[i]
    return 'Yes'
print(m())

Submission status: Wrong Answer

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

    d = dict()
    for i in range(len(s)):
        if s[i] != t[i]:
            if t[i] not in d:
                d[t[i]] = s[i]
            else:
                if d[t[i]] != s[i]:
                    print("No")
                    return
    print("Yes")

if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
def m():
    s = input()
    t = input()
    d = {}
    n = len(s)
    for i in range(n):
        if d.get(t[i],0):
            if d[t[i]] != s[i]:
                return 'No'
        else:
            d[t[i]] = s[i]
    return 'Yes'
print(m())

Submission status: Wrong Answer

Solution code:
def m():
    s = input()
    t = input()
    d = {}
    n = len(s)
    for i in range(n):
        if s[i] == t[i]:
            continue

        if d.get(t[i],0):
            if d[t[i]] != s[i]:
                return 'No'
        else:
            d[t[i]] = s[i]
    return 'Yes'
print(m())

Submission status: Wrong Answer

Solution code:
Ga={}
Gb={}
A=list(input())
B=list(input())
flag = True
for i in range(len(A)):
  if A[i] in Ga and Ga[A[i]] != B[i]:
    flag = False
    break
  else:
    Ga[A[i]] = B[i]
for i in range(len(B)):
  if B[i] in Gb and Gb[B[i]] != A[i]:
    flag = False
    break
  else:
    Gb[B[i]] = A[i]
if flag:
  print("yes")
else:
  print("no")

Submission status: Wrong Answer

Solution code:
import sys
from collections import defaultdict

S = input()
T = input()
L = len(S)

dcts = defaultdict(int)
for i in range(L):
    s = S[i]
    t = T[i]
    if dcts[s] == 0:
        dcts[s] = t
    else:
        if dcts[s] != t:
            print('No')
            sys.exit()
            
    if dcts[t] == 0:
        dcts[t] = s
    else:
        if dcts[t] != s:
            print('No')
            sys.exit()
print('Yes')

Submission status: Wrong Answer

Solution code:
S = list(input())
T = input()
check1 = []
check2 = []
for i in range(len(S)):
    kensa1 = S[i]
    kensa2 = T[i]
    if kensa1 not in check1 and kensa1 not in check2 and kensa2 not in check1 and kensa2 not in check2:
        if kensa1 != kensa2:
            check1.append(kensa1)
            check1.append(kensa2)
            check2.append(kensa2)
            check2.append(kensa1)
        else:
            check1.append(kensa1)
            check2.append(kensa1)
            
    elif (kensa1 in check1 and kensa2 not in check1) or (kensa2 in check1 and kensa1 not in check1):
        if S.count(kensa1) != 1:
            print('No')
            break
        
    elif kensa1 in check1 and kensa2 in check1:
        if check1.index(kensa1) != check2.index(kensa2) and S.count(kensa1) != 1:
            print('No')
            break
    
else:
    print('Yes')

Submission status: Wrong Answer

Solution code:
S = list(input())
T = input()
check1 = []
check2 = []
for i in range(len(S)):
    kensa1 = S[i]
    kensa2 = T[i]
    if kensa1 not in check1 and kensa1 not in check2 and kensa2 not in check1 and kensa2 not in check2:
        if kensa1 != kensa2:
            check1.append(kensa1)
            check1.append(kensa2)
            check2.append(kensa2)
            check2.append(kensa1)
        else:
            check1.append(kensa1)
            check2.append(kensa1)
            
    elif (kensa1 in check1 and kensa2 not in check1) or (kensa2 in check1 and kensa1 not in check1):
        print('No')
        break
        
    elif kensa1 in check1 and kensa2 in check1:
        if check1.index(kensa1) != check2.index(kensa2):
            print('No')
            break
    
else:
    print('Yes')

Submission status: Wrong Answer

Solution code:
S = list(input())
T = input()
check1 = []
check2 = []
for i in range(len(S)):
    kensa1 = S[i]
    kensa2 = T[i]
    if kensa1 not in check1 and kensa1 not in check2 and kensa2 not in check1 and kensa2 not in check2:
        if kensa1 != kensa2:
            check1.append(kensa1)
            check1.append(kensa2)
            check2.append(kensa2)
            check2.append(kensa1)
        else:
            check1.append(kensa1)
            check2.append(kensa1)
            
    elif (kensa1 in check1 and kensa2 not in check2) or (kensa2 in check1 and kensa1 not in check2):
        print('No')
        break
        
    elif kensa1 in check1 and kensa2 in check1:
        if check1.index(kensa1) != check2.index(kensa2):
            print('No')
            break
    
else:
    print('Yes')

Submission status: Wrong Answer

Solution code:
S = list(input())
T = input()
check1 = []
check2 = []
for i in range(len(S)):
    kensa1 = S[i]
    kensa2 = T[i]
    if kensa1 not in check1 and kensa1 not in check2 and kensa2 not in check1 and kensa2 not in check2:
        if kensa1 != kensa2:
            check1.append(kensa1)
            check1.append(kensa2)
            check2.append(kensa2)
            check2.append(kensa1)
        else:
            check1.append(kensa1)
            check2.append(kensa1)
            
    elif (kensa1 in check1 and kensa2 not in check2) or (kensa2 in check1 and kensa1 not in check2):
        print('No')
        break
        
    elif kensa1 in check1 and kensa2 in check1:
        if check1.index(kensa1) != check2.index(kensa2) or check1.index(kensa2) != check2.index(kensa1):
            print('No')
            break
    
else:
    print('Yes')

Submission status: Wrong Answer

Solution code:
S = list(input())
T = input()
check1 = []
check2 = []
for i in range(len(S)):
    kensa1 = S[i]
    kensa2 = T[i]
    if kensa1 not in check1 and kensa1 not in check2 and kensa2 not in check1 and kensa2 not in check2:
        if kensa1 != kensa2:
            check1.append(kensa1)
            check1.append(kensa2)
            check2.append(kensa2)
            check2.append(kensa1)
        else:
            check1.append(kensa1)
            check2.append(kensa1)
            
    elif (kensa1 in check1 and kensa2 not in check2) or (kensa2 in check1 and kensa1 not in check2):
        print('No')
        break
    
else:
    print('Yes')

Submission status: Wrong Answer

Solution code:
s = list(input().strip())
t = list(input().strip())
ss = [s.count(i) for i in set(s)]
tt = [t.count(i) for i in set(t)]
print("Yes" if ss == tt else "No")

Submission status: Wrong Answer

Solution code:
import sys
fin = sys.stdin.readline


S = fin()[:-1]
T = fin()[:-1]

correspondence = dict()
for char_s, char_t in zip(S, T):
    correspondence[char_s] = char_t

if len(set(correspondence.values())) < len(correspondence):
    print("No")
else:
    print("Yes")

Submission status: Wrong Answer

Solution code:
from collections import defaultdict, Counter
from itertools import product, groupby, count, permutations, combinations
from math import pi, sqrt
from collections import deque
from bisect import bisect, bisect_left, bisect_right
from string import ascii_lowercase
from functools import lru_cache
import sys
sys.setrecursionlimit(10000)
INF = float("inf")
YES, Yes, yes, NO, No, no = "YES", "Yes", "yes", "NO", "No", "no"
dy4, dx4 = [0, 1, 0, -1], [1, 0, -1, 0]
dy8, dx8 = [0, -1, 0, 1, 1, -1, -1, 1], [1, 0, -1, 0, 1, 1, -1, -1]


def inside(y, x, H, W):
    return 0 <= y < H and 0 <= x < W


def ceil(a, b):
    return (a + b - 1) // b


# aとbの最大公約数
def gcd(a, b):
    if b == 0:
        return a
    return gcd(b, a % b)


# aとbの最小公倍数
def lcm(a, b):
    g = gcd(a, b)
    return a / g * b


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

    st = dict()
    ts = dict()
    for s, t in zip(S, T):
        if s == t:
            continue

        if s in st and st[s] != t:
            print(No)
            return
        st[s] = t
        if t in ts and ts[t] != s:
            print(No)
            return
        ts[t] = s

    print(Yes)


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
S=input().strip()
T=input().strip()
fl=True
dic={}
for i in range(len(S)):
    if S[i] in dic:
        if dic[S[i]] != T[i]:
            fl=False
            break
    else:
        dic[S[i]]=T[i]
        dic[T[i]]=S[i]
if fl:
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

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

cnt=0
comment="Yes"
for t in T:
    if(comment=="No"):break
    mul=[]
    cnt+=1
    point=0
    #print(t)
    for i in range(cnt,len(T)):#今の文字より後ろの文字を一つずつ
        #print(T[i])
        if(t==T[i]):
            point+=1
            mul.append(i)#重複箇所を記録
    #print(point)
    if(point>0):#重複があった場合、
        #print(" ",cnt-1,S[cnt-1])
        #その箇所でSも同様に重複しているかチェック！
        for imul in mul:
            #print(" ",i,S[i])
            if(S[cnt-1]==S[imul]):
                pass
            else:#ダメな場合
                comment="No"
                break
print (comment)

Submission status: Wrong Answer

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

cnt=0
comment="Yes"
for t in T:
    mul=[]
    if(comment=="No"):break
    cnt+=1
    point=0
    #print(t)
    for i in range(cnt,len(T)):#今の文字より後ろの文字を一つずつ
        #print(T[i])
        if(t==T[i]):
            point+=1
            mul.append(i)#重複箇所を記録
    #print(point)
    if(point>0):#重複があった場合、
        #print(" ",cnt-1,S[cnt-1])
        #その箇所でSも同様に重複しているかチェック！
        for i in mul:
            #print(" ",i,S[i])
            if(S[cnt-1]==S[i]):
                pass
            else:#ダメな場合
                comment="No"
                break
print (comment)

Submission status: Wrong Answer

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

#やっぱ全部イラン気がする
#azzelだったら、zzが見つかった所だけを処理すればいいわけだ
cnt=0
mul=[]
comment="Yes"
for t in T:
    cnt+=1
    point=0
    #print(t)
    for i in range(cnt,len(T)):#今の文字より後ろの文字を一つずつ
        #print(T[i])
        if(t==T[i]):
            point+=1
            mul.append(i)#重複箇所を記録
    #print(point)
    if(point>0):#重複があった場合、
        #print(" ",cnt-1,S[cnt-1])
        #その箇所でSも同様に重複しているかチェック！
        for i in mul:
            #print(" ",i,S[i])
            if(S[cnt-1]==S[i]):
                pass
            else:#ダメな場合
                comment="No"
print (comment)

Submission status: Wrong Answer

Solution code:
from collections import defaultdict
def main():
    S = input()
    T = input()

    s_dict = defaultdict(list)
    t_dict = defaultdict(list)

    for ch_s, ch_t in zip(S, T):
        s_dict[ch_s].append(ch_t)
        t_dict[ch_t].append(ch_s)

    for value in s_dict.values():
        if len(value) >= 2:
            print('No')
            return

    for value in t_dict.values():
        if len(value) >= 2:
            print('No')
            return

    print('Yes')
    return


main()

Submission status: Wrong Answer

Solution code:
S = input()
T = input()
s = list(S)
t = list(T)
a = len(s)
i = 0
while i < a:
    for j in range(i,a-1):
        if (s[i] == s[j]) and (t[i] != t[j]):
            print("No")
            exit()
        if (t[i] == t[j]) and (s[i] != s[j]):
            print("No")
            exit()
    i = i+1
    if i == a:
        print("Yes")
        break

Submission status: Wrong Answer

Solution code:
S = input()
T = input()
s = list(S)
t = list(T)
a = len(s)
i = 0
while i < a:
    for j in range(a-1):
        if (t[i] == t[j]) and (s[i] != s[j]):
            print("No")
            exit()
    i = i+1
    if i == a:
        print("Yes")
        break

Submission status: Wrong Answer

Solution code:
S = input()
T = input()
s = list(S)
t = list(T)
a = len(s)
i = 0
while i < a:
    for j in range(a-1):
        if (t[i] == t[j]) and (s[i] != s[j]):
            print("NO")
            exit()
    i = i+1
    if i == a:
        print("YES")
        break

Submission status: Wrong Answer

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

    DICT = {}

    for ch_s, ch_t in zip(S, T):
        #print(DICT)
        if ch_t in DICT.keys():
            #print(ch_t)
            if DICT[ch_t] != ch_t:
                print('No')
                return
        DICT[ch_t] = ch_s
    print('Yes')
    return


main()

Submission status: Wrong Answer

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

    DICT = {}

    for ch_s, ch_t in zip(S, T):
        print(DICT)
        if ch_t in DICT.keys():
            print(ch_t)
            if DICT[ch_t] != ch_t:
                print('No')
                return
        DICT[ch_t] = ch_s
    print('Yes')
    return


main()

Submission status: Wrong Answer

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

    DICT = {}

    for ch_s, ch_t in zip(S, T):
        #print(DICT)
        if ch_t in DICT.values():
            print('No')
            return
        DICT[ch_s] = ch_t
    print('Yes')
    return


main()

Submission status: Wrong Answer

Solution code:
from collections import defaultdict
def main():
    S = input()
    T = input()

    DICT = defaultdict(list)

    for ch_s, ch_t in zip(S,T):
        DICT[ch_t].append(ch_s)

    for key in DICT.keys():
        #print(key, DICT[key])
        values = DICT[key]
        if len(values) == 1:
            continue
        setvalues = set(values)

        if key in setvalues:
            print('No')
            return

    print('Yes')
    return


main()

Submission status: Wrong Answer

Solution code:
from collections import defaultdict
def main():
    S = input()
    T = input()

    DICT = defaultdict(list)

    for ch_s, ch_t in zip(S,T):
        DICT[ch_t].append(ch_s)

    for key in DICT.keys():
        #print(key, DICT[key])
        if len(DICT[key]) > 1 and key in DICT[key]:
            print('No')
            return

    print('Yes')
    return


main()

Submission status: Wrong Answer

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

tr_s = {}; tr_t = {}
for i in range(len(S)):
    if S[i] != T[i]:
        if S[i] in tr_s:
            if T[i] != tr_s[S[i]]:
                print("No")
                exit()
        else:
            tr_s[S[i]] = T[i]

        if T[i] in tr_t:
            if S[i] != tr_t[T[i]]:
                print("No")
                exit()
        else:
            tr_t[T[i]] = S[i]

print("Yes")

Submission status: Wrong Answer

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

for _ in range(2):
    tr = {}
    for i in range(len(S)):
        if S[i] != T[i]:
            if S[i] in tr:
                if T[i] != tr[S[i]]:
                    print("No")
                    exit()
            else:
                tr[S[i]] = T[i]
    S, T = T, S

print("Yes")

Submission status: Wrong Answer

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

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

S, T = T, S
tr = {}
for i in range(len(S)):
    if S[i] != T[i]:
        if S[i] in tr:
            if T[i] != tr[S[i]]:
                print("No")
                exit()
        else:
            tr[S[i]] = T[i]

print("Yes")

Submission status: Wrong Answer

Solution code:
import collections

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

Sgroup=collections.Counter(S)
Tgroup=collections.Counter(T)

arr1="".join(map(str, list(Sgroup.values())))
arr2="".join(map(str, list(Tgroup.values())))

#print (arr1)
#print (arr2)
if(arr1==arr2):
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
import collections

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

Sgroup=collections.Counter(S)
Tgroup=collections.Counter(T)

arr1=int("".join(map(str, list(Sgroup.values()))))
arr2=int("".join(map(str, list(Tgroup.values()))))

#print (arr1)
#print (arr2)
if(arr1==arr2):
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
import collections

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

Sgroup=collections.Counter(S)
Tgroup=collections.Counter(T)

Sarr=[]
Sarr1=[]
for k,v in Sgroup.items():
    Sarr.append(v)
    Sarr1.append(k)

Tarr=[]
Tarr1=[]

for k,v in Tgroup.items():
    Tarr.append(v)
    Tarr1.append(k)


arr1=int("".join(map(str, Sarr)))
arr2=int("".join(map(str, Tarr)))


if(arr1==arr2):
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
import collections

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

Sgroup=collections.Counter(S)
Tgroup=collections.Counter(T)

Sarr=[]
Sarr1=[]
for k,v in Sgroup.items():
    Sarr.append(v)
    Sarr1.append(k)

Tarr=[]
Tarr1=[]

for k,v in Tgroup.items():
    Tarr.append(v)
    Tarr1.append(k)


arr1=int("".join(map(str, Sarr)))
arr2=int("".join(map(str, Tarr)))

if(len(Sarr)==1):
    if Sarr1[0] == Tarr1[0]:
        print("No")
else:    
     if(arr1==arr2):
        print("Yes")
     else:
        print("No")

Submission status: Wrong Answer

Solution code:
import collections

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

Sgroup=collections.Counter(S)
Tgroup=collections.Counter(T)
#print(Sgroup)
#print(Tgroup)
Sarr=[]
Sarr1=[]
for k,v in Sgroup.items():
    Sarr.append(v)
    Sarr1.append(k)

Tarr=[]
Tarr1=[]
for k,v in Tgroup.items():
    Tarr.append(v)
    Tarr1.append(k)

count=0
flag=True

if(len(Sarr)==1):
    if Sarr1[0] == Tarr1[0]:
        flag=False
else:
    if len(Sarr) == len(Tarr):
        for i in range(len(Tarr)):        
            if Sarr[i] == Tarr[i]:
                count+=1            
  

if(flag and len(Sarr)==count):
    print("Yes")

else:
    print("No")

Submission status: Wrong Answer

Solution code:
import collections

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

Sgroup=collections.Counter(S)
Tgroup=collections.Counter(T)

Sarr=[]
for k,v in Sgroup.items():
    Sarr.append(v)

Tarr=[]
for k,v in Tgroup.items():
    Tarr.append(v)


count=0
if len(Sarr) == len(Tarr):
    for i in range(len(Tarr)):
        if Sarr[i] == Tarr[i]:
            count+=1            
  

if(len(Sarr)==count):
    print("Yes")

else:
    print("No")

Submission status: Wrong Answer

Solution code:
import collections

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

Sgroup=collections.Counter(S)
Tgroup=collections.Counter(T)

Sarr=[]
for k,v in Sgroup.items():
    Sarr.append(v)

Tarr=[]
for k,v in Tgroup.items():
    Tarr.append(v)


count=0
if len(Sarr) == len(Tarr):
    for i in range(len(Tarr)):
        if Sarr[i] == Tarr[i]:
            count+=1            
        else:
            break
            print("No")
else:
    print("No")


if(len(Sarr)==count):
    print("Yes")

Submission status: Wrong Answer

Solution code:

import collections
import copy
a=collections.Counter([x for x in input()])
b=collections.Counter([x for x in input()])
c=sorted(list(a.values()))
d=sorted(list(b.values()))


def join(c):
    for i in range(0,len(c)):
        for j in range(0,i):
            if i != j :
                l= copy.copy(c)
                l.remove(c[i])
                l.remove(c[j])
                l.append(c[i]+c[j])
                if len(l)>len(d):
                    join(l)
                elif len(l)==len(d):
                    if d == sorted(l):
                        print("Yes")
                        quit()

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

Submission status: Wrong Answer

Solution code:

import collections
import copy
a=collections.Counter([x for x in input()])
b=collections.Counter([x for x in input()])
c=sorted(list(a.values()))
d=sorted(list(b.values()))


def join(c):
    for i in range(0,len(c)):
        for j in range(0,i):
            if i != j :
                l= copy.copy(c)
                l.remove(c[i])
                l.remove(c[j])
                l.append(c[i]+c[j])
                if len(l)>len(d):
                    join(l)
                elif len(l)==len(d):
                    if d == l:
                        print("Yes")
                        quit()

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

Submission status: Wrong Answer

Solution code:


import collections
import copy
a=collections.Counter([x for x in input()])
b=collections.Counter([x for x in input()])
c=sorted(list(a.values()))
d=sorted(list(b.values()))
x=[]
x.append(c)
def join(c):
    for i in range(0,len(c)):
        for j in range(0,i):
            if i != j :
                l= copy.copy(c)
                l.remove(c[i])
                l.remove(c[j])
                l.append(c[i]+c[j])
                x.append(sorted(l))
                if len(l)!=1:
                    join(l)
join(c)
arr = list(map(list,set(map(tuple, x))))
for k in arr:
    if k == d:
        print("Yes")
        exit()
print("No")

Submission status: Wrong Answer

Solution code:

import collections
import copy
a=collections.Counter([x for x in input()])
b=collections.Counter([x for x in input()])
c=sorted(list(a.values()))
d=sorted(list(b.values()))
x=[]
x.append(c)
def join(c):
    for i in range(0,len(c)):
        for j in range(0,i):
            if i != j :
                l= copy.copy(c)
                l.remove(c[i])
                l.remove(c[j])
                l.append(c[i]+c[j])
                x.append(sorted(l))
                if len(l)!=1:
                    join(l)
join(c)
arr = list(map(list,set(map(tuple, x))))
print(arr)
for k in arr:
    if k == d:
        print("Yes")
        exit()
print("No")

Submission status: Wrong Answer

Solution code:

import collections
import copy
a=collections.Counter([x for x in input()])
b=collections.Counter([x for x in input()])
c=sorted(list(a.values()))
d=sorted(list(b.values()))
x=[]
x.append(c)
def join(c):
    for i in range(0,len(c)):
        for j in range(0,len(c)):
            if i != j :
                l= copy.copy(c)
                l.remove(c[i])
                l.remove(c[j])
                l.append(c[i]+c[j])
                x.append(l)
                join(l)
join(c)
arr = list(map(list,set(map(tuple, x))))
for k in arr:
    if k == d:
        print("Yes")
        exit()
print("No")

Submission status: Wrong Answer

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

import collections

a = collections.Counter(S)
b = collections.Counter(T)

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


flagCount = 0
for key1, key2 in zip(a,b):
    if(a[key1] == b[key2]):
        flagCount += 1


print(a)
print(b)
if(flagCount == len(a)):
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

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

import collections

a = collections.Counter(S)
b = collections.Counter(T)

flagCount = 0
for key1, key2 in zip(a,b):
    if(a[key1] == b[key2]):
        flagCount += 1

if(flagCount == len(a)):
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
LN1 = list(input())
LN2 = list(input())

LL1 = len(LN1)
LL2 = len(LN2)

LV1 = [0]
LV2 = [0]

CO = 1

for i in range(1,LL1):
    CH = 0
    for x in range(0,i): 
        if LN1[i] == LN1[x]:
            LV1.append(LV1[x])
            CH = 1
    if CH == 0:
        LV1.append(CO)
        CO += 1

CO = 1

for i in range(1,LL1):
    CH = 0
    for x in range(0,i): 
        if LN2[i] == LN2[x]:
            LV2.append(LV2[x])
            CH = 1
    if CH == 0:
        LV2.append(CO)
        CO += 1

print(LV1)
print(LV2)

        
if LV1 == LV2:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
from collections import Counter
import numpy as np

s = input()
t = input()

l = list(set([(s[i], t[i]) for i in range(len(s))]))

l2 = []

for i in l:
    l2.extend([i[0], i[1]])

c = Counter(l2)
values, counts = zip(*c.most_common())
k = np.where(np.array(counts)>2)[0]

if len(k) >= 1:
    print('No')
else:
    print('Yes')

Submission status: Wrong Answer

Solution code:
s=input()
t=input()
l=len(s)
sl=[]
tl=[]
slist=[0]*26
tlist=[0]*26
flag=0
sabc=''
tabc=''
for i in range(l):
    sb=not s[i] in sabc
    tb=not t[i] in tabc
    if sb==tb:
        if sb:

            sabc+=s[i]
            tabc+=t[i]
        else:
            slist[sabc.find(s[i])]
            tlist[tabc.find(t[i])]
    else:
        flag=1
        break
    if slist!=tlist:
        flag=1
        break
if flag==1:
    print('No')
else:
    print('Yes')

Submission status: Wrong Answer

Solution code:
s=input()
t=input()
l=len(s)
sl=[]
tl=[]
slist=[]
tlist=[]
flag=0
sabc=''
tabc=''
for i in range(l):
    sb=not s[i] in sabc
    tb=not t[i] in tabc
    if sb==tb:
        if sb:

            sabc+=s[i]
            tabc+=t[i]
        else:
            pass
    else:
        flag=1
        break
if flag==1:
    print('No')
else:
    print('Yes')

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
S=input()
T=input()
string="abcdefghijklmnopqrstuvwuxyz"
s=[0 for i in range(27)]
t=[0 for i in range(27)]
for i in range(27):
    s[i]+=S.count(string[i])
    t[i]+=T.count(string[i])
print("Yes" if sorted(s)==sorted(t) else "No")

Submission status: Wrong Answer

Solution code:
import collections
S=input()
T=input()
a1=collections.Counter(S)
a2=collections.Counter(T)
if a1==a2:
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

Solution code:
from collections import defaultdict

def a(s):
    dic = defaultdict(list)
    for i, ch in enumerate(s):
        dic[ch].append(i)
    return list(dic.values())

s = input()
t = input()
print('Yes' if a(s) == a(t) else 'No')

Submission status: Wrong Answer

Solution code:
from collections import defaultdict

def p(X):
    d = defaultdict(list)    
    for i, c in enumerate(X):
        d[c].append(i)
    return tuple(d.values())

S = input()
T = input()

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

Submission status: Wrong Answer

Solution code:
from collections import Counter
S = input()
T = input()

for w in list(S):
    if w in list(T):
        S = list(S)
        T = list(T)
        idx = S.index(w)
        del S[idx]
        del T[idx]
        S = ''.join(S)
        T = ''.join(T)
s_count = Counter(S)
del_s = []
t_count = Counter(T)
del_t = []

for ks, vs in list(s_count.items()):
    for kt, vt in list(t_count.items()):
        if vs == vt:
            del_s.append(ks)
            del_t.append(kt)
            del s_count[ks]
            del t_count[kt]
            break

if len(S) == len(del_s):
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

Solution code:
s = input()
t = input()
st = [0 for i in range(26)]
tt = [0 for i in range(26)]
for i in range(26):
    st[i] = s.count(chr(ord('a') + i))
    tt[i] = t.count(chr(ord('a') + i))
for i in range(len(s)):
    if st[i] != tt[i]:
        print('No')
        quit()
print('Yes')

Submission status: Wrong Answer

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

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