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

Solution (Python):
s, t = [input() for _ in range(2)]

while True:
    if s == "":
        break

    s = s.replace(s[0], "")
    t = t.replace(t[0], "")
    
    if len(s) != len(t):
        print("No")
        exit(0)

print("Yes")

Solution (Python):
a = list(input())
b = list(input())
c = len(a)
p = 0
d = [0 for i in range(27)]
l = [[]for i in range(27)]
h = [[]for i in range(27)]
ll = [0 for i in range(27)]
if a == b:
	print("Yes")
else:
	for i in range(c):
		k = ord(b[i])-97
		if a[i] in l[k]:
			p = 0
		else:
			if len(l[k]) == 0:
				l[k].append(a[i])
			else:
				p = 1
				break
		k = ord(a[i])-97
		if b[i] in h[k]:
			p = 0
		else:
			if len(h[k]) == 0:
				h[k].append(b[i])
			else:
				p = 1
				break
	if p == 1:
		print("No")
	else:
		print("Yes")

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

dict1 = {}
ls =[]
for i in range(len(S)):
    if S[i] not in dict1:
        dict1[S[i]] = i
    ls.append(dict1[S[i]])

dict2 = {}
lt =[]
for i in range(len(T)):
    if T[i] not in dict2:
        dict2[T[i]] = i
    lt.append(dict2[T[i]])

if ls == lt:
    print("Yes")
else:
    print("No")

Solution (Python):
s=input()
t=input()
n=len(s)



sl=list(s)

sl.sort()
sl=''.join(sl)

a=''
for i in range(n):
    if(sl[i]==a):continue
    a=sl[i]
    b=t[s.index(a)]
    s=s.translate(str.maketrans({a:b,b:a}))
    sl=sl.translate(str.maketrans({a:b,b:a}))
    

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

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

tdic = dict()
sdic = dict()
for i in range(len(S)):
    if T[i] in tdic:
        if tdic[T[i]] != S[i]:
            print("No")
            break
    else:
        tdic[T[i]] = S[i]

    if S[i] in sdic:
        if sdic[S[i]] != T[i]:
            print("No")
            break
    else:
        sdic[S[i]] = T[i]
else:
    print("Yes")

Solution (Python):
inputS = input()
arrayS = list(inputS)
arraySorted = list(inputS)
arraySorted.sort()
inputT = input()
arrayT = list(inputT)
arrayTSorted = list(inputT)
arrayTSorted.sort()

flagForA =0

index = 0
length = len(arrayS)
listForSame = []
while index < length-1:
    if arraySorted[index] == arraySorted[index+1]:
        if arraySorted[index] in listForSame:
            pass
        else:
            listForSame.append(arraySorted[index])
    index+=1
if listForSame == []:
    flagForA=1
else:
    flag =0
    listForSet =[]
    for caburi in listForSame:
        index2 =0
        listForAdd = []
        while index2 < length:
            if arrayS[index2] == caburi:
                listForAdd.append(index2)
            index2+=1
        listForSet.append(listForAdd)
    for everySet in listForSet:
        index3 =0
        while index3 < len(everySet)-1:
            if arrayT[everySet[index3]] == arrayT[everySet[index3+1]]:
                index3+=1
            else:
                flag =1
                flagForA=0
                break
    if flag ==0:
        flagForA=1
    else:
        flagForA=0

flagForB =0           

index = 0
length = len(arrayT)
listForSame2 = []
while index < length-1:
    if arrayTSorted[index] == arrayTSorted[index+1]:
        if arrayTSorted[index] in listForSame2:
            pass
        else:
            listForSame2.append(arrayTSorted[index])
    index+=1
if listForSame2 == []:
    flagForB=1
else:
    flag =0
    listForSet =[]
    for caburi in listForSame2:
        index2 =0
        listForAdd = []
        while index2 < length:
            if arrayT[index2] == caburi:
                listForAdd.append(index2)
            index2+=1
        listForSet.append(listForAdd)
    for everySet in listForSet:
        index3 =0
        while index3 < len(everySet)-1:
            if arrayS[everySet[index3]] == arrayS[everySet[index3+1]]:
                index3+=1
            else:
                flag =1
                flagForB=0
                break
    if flag ==0:
        flagForB=1
    else:
        flagForB=0


allUsedFlagS =0
allUsedFlagT =0
flagForC =1
if length > 25:
    for char in [chr(i) for i in range(97,97+26)]:
        if char in arraySorted:
            pass
        else:
            allUsedFlagS =1
            break
    for char in [chr(i) for i in range(97,97+26)]:
        if char in arrayTSorted:
            pass
        else:
            allUsedFlagT =1
            break
    if allUsedFlagS ==0 and allUsedFlagT ==0:
        alphaList = [chr(i) for i in range(97,97+26)]
        sosuuList = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101, 103]
        numberS =1
        for char1 in arrayS:
            index1 = alphaList.index(char1)
            numberS*= sosuuList[index1]
        numberT =1
        for char2 in arrayT:
            index2 = alphaList.index(char2)
            numberT*= sosuuList[index2]
        if numberS!=numberT:
            flagForC=0
        else:
            flagForC=1

        
if flagForA ==1 and flagForB==1 and flagForC==1:
    print("Yes")  
else:
    print("No")

Solution (Python):
s = input()
t = input()
ls = []
lt = []
lists=[]

for i in s:
  ls.append(i)
  
for j in t:
  lt.append(j)

ls2 = set(ls)
lt2 = set(lt)

n = len(ls)

for i in range(n):
  list1 = [ls[i],lt[i]]
  lists.append(list1)

lists2 = list(map(list, set(map(tuple, lists))))
  
  
if len(set(ls2)) != len(set(lt2)):
  print('No')
elif len(lists2) != len(set(lt2)):
  print('No')
else:
  print('Yes')

Solution (Python):
s = str(input())
t = str(input())
dict_s = {letter:s.count(letter) for letter in set(s)}
dict_t = {letter:t.count(letter) for letter in set(t)}
list_s = list(dict_s.values())
list_t = list(dict_t.values())
list_s.sort()
list_t.sort()
for letter in set(s):
  if s.count(letter) == 1:
    s = s.replace(letter, "@")
for letter in set(t):
  if t.count(letter) == 1:
    t = t.replace(letter, "@")
ans_s = []
ans_t = []
for letter in dict_s.keys():
  ans_s.append(([i for i, x in enumerate(s) if x == letter]))
for letter in dict_t.keys():
  ans_t.append(([i for i, x in enumerate(t) if x == letter]))
ans_s.sort()
ans_t.sort()
if ans_s == ans_t:
  print("Yes")
else:
  print("No")

Solution (Python):



def main():
    from collections import Counter
    s = sorted(Counter(list(input())).items(), key=lambda x: x[0])
    t = sorted(Counter(list(input())).items(), key=lambda x: x[0])
    diff_s = [0] * 26
    diff_t = [0] * 26
    alphabets = [chr(ord('a') + i) for i in range(26)]

    if len(s) == len(t):
        for alpha, count in s:
            if alpha in alphabets:
                diff_s[alphabets.index(alpha)] = count

        for alpha, count in t:
            if alpha in alphabets:
                diff_t[alphabets.index(alpha)] = count

        for si, ti in zip(sorted(diff_s), sorted(diff_t)):
            if si != ti:
                print('No')
                exit()

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


if __name__ == '__main__':
    main()

Solution (Python):
S = list(input())
T = list(input())
flag = False
S_uniq = list(set(S))
S_duplicate = [x for x in set(S) if S.count(x) > 1]
T_uniq = list(set(T))
T_duplicate = [x for x in set(T) if T.count(x) > 1]
if len(S_uniq) != len(T_uniq):
    flag = True
else:
    for j in S_duplicate: 
        S_indexes = [i for i, x in enumerate(S) if x == j]
        T_single = T[min(S_indexes)]
        T_indexes = [i for i, x in enumerate(T) if x == T_single]
        if S_indexes != T_indexes:

            flag = True
            break
if flag:
    print('No')
else:
    print('Yes')

Solution (Python):
S = input()
T = input()
used = [0] * 30
inv = [i for i in range(0, 30)]

for i in range(30):
    used[i] = chr(ord('a') + i)

for i in range(len(S)):
    idx = ord(S[i]) - ord('a')
    idx2 = ord(T[i]) - ord('a')
    idx3 = ord(used[idx]) - ord('a')
    if used[idx] == T[i]:
        continue
    used[idx],used[inv[idx2]],inv[idx3],inv[idx2]= used[inv[idx2]], used[idx], inv[idx2], inv[idx3]


SS = ''
for i in range(len(S)):
    idx = ord(S[i]) - ord('a')
    SS = SS + used[idx]

ans = SS == T
print ('Yes' if ans else 'No')

Solution (Python):
dica=[]
dicb=[]

S=raw_input()
T=raw_input()

N=len(S)

a=''
b=''
countA=0
countB=0
flag=0
for i in range(N):
	if S[i] in dica:
		a+=str(dica.index(S[i]))
	else:
		dica.append(S[i])
		a+=str(dica.index(S[i]))
		
	if T[i] in dicb:
		b+=str(dicb.index(T[i]))
	else:
		dicb.append(T[i])
		b+=str(dicb.index(T[i]))
		
	if a!=b:
		print 'No'
		flag=1
		break
				

if flag==0:
	if a==b:
		print 'Yes'
	else:
		print 'No'

Solution (Python):
def dout(chrs):
    for i in range(26):
        print(chr(97 + i))
        print(chrs[i])

Schrs = [list() for i in range(26)]
Tchrs = [list() for i in range(26)]
S = input()
T = input()

for i in range(0, len(S)):
    Schrs[ord(S[i]) - 97].append(i)
for i in range(0, len(T)):
    Tchrs[ord(T[i]) - 97].append(i)

ans = 'Yes'
for i in range(26):
    if len(Schrs[i]) >= 2:
        TargetChr = T[Schrs[i][0]]
        TargetIndex = ord(TargetChr) - 97
        if Schrs[i] != Tchrs[TargetIndex]:
            print('No')
            exit(0)
for i in range(26):
    if len(Tchrs[i]) >= 2:
        TargetChr = S[Tchrs[i][0]]
        TargetIndex = ord(TargetChr) - 97
        if Tchrs[i] != Schrs[TargetIndex]:
            print('No')
            exit(0)

print(ans)

Solution (Python):
a=raw_input()
b=raw_input()

aa=list(a)
bb=list(b)

aa.sort()
bb.sort()

aaa=[]
ac=0
acw=aa[0]
for i in aa:
    if acw==i:
        ac+=1
    else:
        acw=i
        aaa.append(ac)
        ac=1
aaa.append(ac)

bbb=[]
bc=0
bcw=bb[0]
for i in bb:
    if bcw==i:
        bc+=1
    else:
        bcw=i
        bbb.append(bc)
        bc=1
bbb.append(bc)

aaa.sort()
bbb.sort()
ch=0
if len(aaa)==len(bbb):
    for i in range(len(aaa)):
        if aaa[i]!=bbb[i]:
            print "No"
            ch=1
            break
else:
    print "No"
    ch=1

if ch==0:
    print "Yes"

Solution (Python):
S = list(input())
T = list(input())
alpha_s = [0 for _ in range(26)]
alpha_t = [0 for _ in range(26)]
ans = 'Yes'
for i in range(len(S)):
	alpha_s[ord(S[i]) - 97] += 1
	alpha_t[ord(T[i]) - 97] += 1
	if alpha_s[ord(S[i]) - 97] != alpha_t[ord(T[i]) - 97]:
		ans = 'No'
		break
print(ans)

Solution (Python):
from collections import Counter

S = input()
T = input()

scnt = sorted(list(Counter(S).values()))
tcnt = sorted(list(Counter(T).values()))

print('Yes' if scnt == tcnt else 'No')

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

from collections import Counter
sd = Counter(S)
td = Counter(T)

sdd = Counter(list(sd.values()))
tdd = Counter(list(td.values()))

for k,v in sdd.items():
  if k not in tdd or tdd[k] != sdd[k]:
    print("No")
    exit()

print("Yes")

Solution (Python):
import collections
s = input()
t = input()
loop = len(s)
s_col = collections.Counter(s)
t_col = collections.Counter(t)

s_l = sorted(s_col.values())



t_l = sorted(t_col.values())


if s_l == t_l:
    print("Yes")
else:
    print("No")

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

s = set(S)


t = set(T)
list_s = list(s)
list_t = list(t)

list_S = []
list_T = []

for i in range(len(list_s)):
  count = S.count(str(list_s[i]))
  list_S.append(int(count))


for j in range(len(list_t)):
  count = T.count(str(list_t[j]))
  list_T.append(int(count))

list_S.sort()
list_T.sort()




if (list_S == list_T):
  print("Yes")
else:
  print("No")

Solution (Python):
s = input()
t = input()
def check(a,b):
  l = []
  for c in a:
    if c in l:
      continue
    l.append(c)
    if a.count(c) > 1:
      m = [i for i, x in enumerate(a) if x == c]
      for i in range(1,len(m)):
        if b[m[i]] != b[m[0]]:
          return "No" 
  return "Yes"
ans = check(s,t)
if ans == "Yes" : ans = check(t,s)
print(ans)

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

naga = len(S)
count = 0
for i in range(naga):
    ss = S[i]
    tt = T[i]
    if S.find(ss) != -1 :
        count = count + 1
    S = S.replace(ss,"!")
    S = S.replace(tt,ss)
    S = S.replace("!",tt)

    if count > 28:
        break


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

Solution (Python):
S = list(raw_input())
T = list(raw_input())



corr = {}
for i, s in enumerate(S):
    if s in corr.keys() and corr[s] != T[i]:
        print("No")
        exit(0)
    corr[s] = T[i]

corr = {}
for i, t in enumerate(T):
    if t in corr.keys() and corr[t] != S[i]:
        print("No")
        exit(0)
    corr[t] = S[i]

print("Yes")

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

X = [[] for _ in range(26)]
Y = [[] for _ in range(26)]
for i in range(n):
    s = ord(S[i]) - 97
    t = ord(T[i]) - 97
    X[s].append(i)
    Y[t].append(i)

P = [tuple(x) for x in X]
Q = [tuple(y) for y in Y]
if set(P) == set(Q):
    print('Yes')
else:
    print('No')

Solution (Python):
S = input()
T = input()
s_changed = {}
t_changed = {}
for s, t in zip(S, T):
    if s not in s_changed:
        s_changed[s] = t
    if t not in t_changed:
        t_changed[t] = s
    if not (s_changed[s] == t and t_changed[t] == s):
        print('No')
        break
else:
    print('Yes')

Solution (Python):
S=input()
T=input()
L=len(S)
AZ="ABCDEFGHIJKLMNOPQRSTUVWXYZ"
j=0
for i in range(L):
	if S[i:i+1].islower()==True:
		S=S.replace(S[i],AZ[j])
		j=j+1
k=0
for i in range(L):
	if T[i:i+1].islower()==True:
		T=T.replace(T[i],AZ[k])  
		k=k+1
if S==T:
	print("Yes")
else:
	print("No")

Solution (Python):
import sys

a = list(input())
b = list(input())

if len(a) != len(b):
    print('No')
    sys.exit(0)
transf = dict([])
used = set([])
for i in range(len(a)):
    if a[i] in transf.keys() and transf[a[i]] != b[i]:
        print('No')
        sys.exit(0)
    if a[i] not in transf.keys():
        if b[i] in used:
            print('No')
            sys.exit(0)
        else:
            used.add(b[i])
        transf[a[i]] = b[i]
        
print('Yes')

Solution (Python):
from sys import stdin

S = stdin.readline().rstrip()
T = stdin.readline().rstrip()

flag = True
for i in range(len(S)):
    S1 = S

    if S[i] != T[i]:
        S = S.translate(str.maketrans({S[i]: T[i], T[i]: S[i]}))
    else:
        continue

    if i == 0:
        continue
    elif i > 0 and S[:i] == S1[:i]:
        pass
    else:
        flag = False
        break

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

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

slist,tlist = [[] for _ in range(26)],[[] for _ in range(26)]

for i in range(len(s)):
  slist[ord(s[i])-ord('a')].append(str(i))
  tlist[ord(t[i])-ord('a')].append(str(i))

stargets,ttargets = [],[]
for x in range(26):
  if len(slist[x]) > 0:
    stargets.append(''.join(slist[x]))
  if len(tlist[x]) > 0:
    ttargets.append(''.join(tlist[x]))
stargets.sort()
ttargets.sort()
if stargets == ttargets:
  print('Yes')
else:
  print('No')

Solution (Python):
def main():
    S = input()
    T = input()
    items = {}
    items2 = {}
    can = True
    for s, t in zip(S, T):
        if s in items2:
            if items2[s] == t:
                continue
            can = False
            break
        if t in items:
            if items[t] == s:
                continue
            can = False
            break
        items[t] = s
        items2[s] = t
    if can:
        print('Yes')
    else:
        print('No')


if __name__ == '__main__':
    main()

Solution (Python):
s_str = [ord(i) for i in input()]
t_str = [ord(i) for i in input()]

s = sorted(s_str)
t = sorted(t_str)

cnt_s = 1
cnt_t = 1
s_num = []
t_num = []

for i in range(len(s)-1):
    if s[i] == s[i+1]:
        cnt_s += 1
        if i == len(s)-2:
            s_num.append(cnt_s)
    else:
        s_num.append(cnt_s)
        cnt_s = 1
    if t[i] == t[i+1]:
        cnt_t += 1
        if i == len(s)-2:
            t_num.append(cnt_t)
    else:
        t_num.append(cnt_t)
        cnt_t = 1

s_num = sorted(s_num)
t_num = sorted(t_num)

if s_num == t_num:
    print("Yes")
else:
    print("No")

Solution (Python):
A=input()
B=input()
d={}
nglist=[]
flag=0




usedj=[]
targets=[]
for i,j in zip(A,B):
    if i not in d:
        d[i] = j
        if j not in usedj:
            usedj.append(j)
        else:
            targets.append(j)

    else:
        if d[i] != j:
            flag=1
            break


if len(set(A)&set(targets)) >0:
    flag=1

    
    

    
    
    
    
    



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

Solution (Python):
import collections
S = (input())
T = (input())

count1 = collections.Counter(S)
count2 = collections.Counter(T)

count1=sorted(count1.items(), key=lambda x: x[1])
count2=sorted(count2.items(), key=lambda x: x[1])


indexes = []
indexes2 = []

if len(S) == len(T):
    if len(count1) != len(count2):
        print('No')
    else:
        for k1, k2 in zip(count1, count2):
            if k1[1] > 1:
                indexes.append(tuple([i for i, x in enumerate(S) if x == k1[0]]))
                indexes2.append(tuple([i for i, x in enumerate(T) if x == k2[0]]))
        if set(indexes) == set(indexes2):
            print('Yes')
        else:
            print('No')
else:
    print('No')

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

    n = len(s)
    ds,dt = {},{}

    for i in range(n):
        if s[i] in ds:
            if ds[s[i]] != t[i]:
                return 'No'
        else:
            ds[s[i]] = t[i]

        if t[i] in dt:
            if dt[t[i]] != s[i]:
                return 'No'
        else:
            dt[t[i]] = s[i]

    return 'Yes'

if __name__ == '__main__':
    print(main())

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

ans = "Yes"

def CheckDup(src, dest):
    dic = {}
    for i in range(len(src)):
        if src[i] in dic:
            if dic[src[i]] != dest[i]:
                return("No")
        else:
            dic[src[i]] = dest[i]
    return("Yes")

ans1 = CheckDup(S, T)
ans2 = CheckDup(T, S)

if ans1 == "No" or ans2 == "No":
    ans = "No"

print(ans)

Solution (Python):
s = input()
t = input()
used_str = []
for i in range(len(s)):
  if s[i] != t[i] and not s[i] in used_str and not t[i] in used_str:
    s = s.translate(str.maketrans(s[i]+t[i],t[i]+s[i]))
    used_str.append(s[i])
    used_str.append(t[i])

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

Solution (Python):
def c_string_transformation(S, T):
    from collections import defaultdict
    cs = defaultdict(str)
    ct = defaultdict(str)
    for k, (c1, c2) in enumerate(zip(S, T)):
        if c1 not in cs[c2]:
            cs[c2] += c1
        if c2 not in ct[c1]:
            ct[c1] += c2
    ans = 'Yes'
    for _, v in cs.items():
        if len(v) >= 2:
            ans = 'No'
            break
    for _, v in ct.items():
        if len(v) >= 2:
            ans = 'No'
            break
    return ans

S = input()
T = input()
print(c_string_transformation(S, T))

Solution (Python):
s = input()
t = input()
        
dic = "abcdefghijklmnopqrstuvwxyz"
s_dic = {}
t_dic = {}
for i in dic:
    s_dic[i] = []
    t_dic[i] = []

for i in range(len(s)):
    s_dic[s[i:i+1]].append(i)
    t_dic[t[i:i+1]].append(i)

s_list = s_dic.values()
t_list = t_dic.values()

if sorted(s_list) == sorted(t_list):
    print("Yes")
else:
    print("No")

Solution (Python):
s=list(input())
t=list(input())
import collections
s_c=collections.Counter(s)
t_c=collections.Counter(t)
s_val, s_count=zip(*s_c.most_common())
t_val, t_count=zip(*t_c.most_common())
if list(s_count)==list(t_count):
    print('Yes')
else:
    print('No')

Solution (Python):
S=input()
T=input()
x=len(S)
S_lett=[]
T_lett=[]
for i in range(x):
	if (S[i] in S_lett) and (T[i] in T_lett):
		if S_lett.index(S[i]) != T_lett.index(T[i]):
			print("No")
			break
			
	elif (S[i] in S_lett)==0 and (T[i] in T_lett)==0:
		S_lett.append(S[i])
		T_lett.append(T[i])
	else:
		print("No")
		break
		
else:
	print("Yes")

Solution (Python):



def main():
    S = raw_input()
    T = raw_input()
    alp = "abcdefghijklmnopqrstuvwxyz"

    
    for ele in alp:
        t = [j for j, e in enumerate(T) if e == ele]
        if t:
            
            s = [j for j, e in enumerate(S) if e == S[t[0]]]
            if t != s:
                print("No")
                exit()

    print("Yes")


if __name__ == "__main__":
    main()

Solution (Python):
import numpy as np
A = np.array(list(input()))
B = np.array(list(input()))
A_unique = np.unique(A)
B_unique = np.unique(B)
ans = 'Yes'
for i in range(A_unique.shape[0]):
    if len(np.unique(B[np.where(A == A_unique[i])])) != 1:
        ans = 'No'
        break
for i in range(B_unique.shape[0]):
    if len(np.unique(A[np.where(B == B_unique[i])])) != 1:
        ans = 'No'
        break
print(ans)

Solution (Python):
import numpy as np
from string import ascii_lowercase
s = list(input())
t = list(input())

s_c = []
t_c = []

for a in ascii_lowercase:
  if s.count(a) != 0:
    s_c.append(s.count(a))
  if t.count(a) != 0:
    t_c.append(t.count(a))

if np.array_equal(sorted(s_c), sorted(t_c)):
	print('Yes')
else:
	print('No')

Solution (Python):
import numpy as np
S = list(input())
T = list(input())
r = "Yes"
end_list = np.array([0] * len(S))
for i in range(len(S)):
    if end_list[i] == 0:
        s1 = S[i]
        t1 = T[i]
        s_bit = list(map(lambda x:1 if x==s1 else 0, S))
        t_bit = list(map(lambda x:1 if x==t1 else 0, T))
        if s_bit != t_bit:
            r = "No"
            break
        end_list += np.array(s_bit)
print(r)

Solution (Python):



s = input()
t = input()

sd = {}
td = {}

for si, ti in zip(s, t):
    if si in sd:
        sd[si] += 1
    else:
        sd[si] = 1
    if ti in td:
        td[ti] += 1
    else:
        td[ti] = 1

sl = list(sd.values())
tl = list(td.values())
sl.sort()
tl.sort()

if sl == tl:
    print('Yes')
else:
    print('No')

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

m = {}
n = {}
for s, t in zip(S, T):
    if s in m and m[s] != t:
        print("No")
        break
    else:
        m[s] = t

    if t in n and n[t] != s:
        print("No")
        break
    else:
        n[t] = s
else:
    print("Yes")

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

alpha = [chr(i) for i in range(97, 97+26)]
dictalpha = {}
dictans = {}
for i in alpha:
    dictalpha[i] = []
    dictans[i] = []
for i in range(len(S)):
    dictalpha[S[i]].append(i)
    dictans[T[i]].append(i)

for i in dictans.values():
    if i not in dictalpha.values():
        print("No")
        exit()

print("Yes")

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


n = len(S)

tableS = {}
tableT = {}

for i in range(n):
    f = S[i]
    t = T[i]
    if f  in tableS:
        if tableS[f] != t:
            print('No') 
            exit()
    tableS[f] = t
    if t in tableT:
        if tableT[t] != f:
            print('No')
            exit()
    tableT[t] = f

print('Yes')

Solution (Python):
s, t = input(), input()
alp_dict = {}
alp_dict2 = {}
for i, j in zip(s, t):
    if not j in alp_dict:
        alp_dict[j] = i
    elif alp_dict[j] == i:
        pass
    else:
        print("No")
        exit()  
    if not i in alp_dict2:
        alp_dict2[i] = j
    elif alp_dict2[i] == j:
        pass
    else:
        print("No")
        exit()  

print("Yes")

Solution (Python):
s = input().strip()
t = input().strip()

d1 = {}
d2 = {}

re = "Yes"
co = 0
for c1,c2 in zip(s,t):
    if (c1 not in d1) and (c2 not in d2):
        d1[c1] = co
        d2[c2] = co
    else:
        if (c1 not in d1) or (c2 not in d2):
            re = "No"
            break
        if d1[c1] != d2[c2]:
            re = "No"
            break
    co += 1

print(re)

Solution (Python):
c1 = input()
c2 = input()

length = len(c1)
list1 = {}
list2 = {}
ok = True
for i in range(length):
    if(c2[i] in list1):
        if(list1[c2[i]] != c1[i]):
            ok = False
            exit
    else:
        list1[c2[i]] = c1[i]

    if(c1[i] in list2):
        if(list2[c1[i]] != c2[i]):
            ok = False
            exit
    else:
        list2[c1[i]] = c2[i]

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

Solution (Python):
from collections import defaultdict
def getN():
    return int(input())

def getMN():
    a = input().split()
    b = [int(i) for i in a]
    return b[0],b[1]

def getlist():
    a = input().split()
    b = [int(i) for i in a]
    return b

def syori(instr):
    moji = defaultdict(list)
    for i, s in enumerate(instr):
        moji[s].append(i)
    

    lisstrs = []
    for v in moji.values():
        lisstr = "@".join([str(i) for i in(v)])
        lisstrs.append(lisstr)
    st = set(lisstrs)
    
    return (st)



stra = input()
strb = input()

aset  = syori(stra)
bset = syori(strb)

if aset == bset:
    print("Yes")
else:
    print("No")

Solution (Python):


from collections import deque
import itertools as it
import sys
import math

sys.setrecursionlimit(1000000)

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

print "Yes"

Solution (Python):
import collections
s=input().strip()
t=input().strip()
s_list=[]
t_list=[]
for char in s:
    s_list.append(char)
for char in t:
    t_list.append(char)
s_collection=collections.Counter(s_list)
t_collection=collections.Counter(t_list)
s_countlist=[]
t_countlist=[]
for entry in s_collection.values():
    s_countlist.append(entry)
for entry in t_collection.values():
    t_countlist.append(entry)
s_countlist.sort()
t_countlist.sort()
if s_countlist == t_countlist:
    print("Yes")
else:
    print("No")

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

pair = []
flag=0

for i in range(len(S)):
  pair.append([S[i], T[i]])
  
pair1 = sorted(pair, key=lambda x:x[0])
pair2 = sorted(pair, key=lambda x:x[1])

for i in range(len(pair1)-1):
  pai = pair1[i]
  if pai[0] == pair1[i+1][0] and pai[1] != pair1[i+1][1]:
    flag=1
    break
for i in range(len(pair2)-1):
  pai = pair2[i]
  if pai[1] == pair2[i+1][1] and pai[0] != pair2[i+1][0]:
    flag=1
    break
    
if flag:
  print("No")
else:
  print("Yes")

Solution (Python):
s = input()
t = input()
for i in [chr(i) for i in range(97, 97+26)]:
    a = s.count(i)
    b = t.count(i)
    s = s.replace(i, str(a))
    t = t.replace(i, str(b))
if s == t:
    print("Yes")
else:
    print("No")

Solution (Python):
s=list(input())
t=list(input())
s_res = sorted(set(s), key=s.index)
t_res = sorted(set(t), key=t.index)
sl = [s.count(e) for e in s_res]
tl = [t.count(e) for e in t_res]
if sl==tl:
    print('Yes')
else:
    print('No')

Solution (Python):
S=input()
T=input()
tbl = [0] * 26
tbl2 = [0] * 26
flag = True
for s,t in zip(S,T):
  c = ord(s)-ord('a')
  if tbl[c] == 0:
    tbl[c] = t
  elif tbl[c] == t:
    pass
  else:
    flag = False
    break
for s in tbl:
  if s == 0:
    continue
  c = ord(s)-ord('a')
  if 0 < tbl2[c]:
    flag = False
    break
  else:
    tbl2[c] = 1
print('Yes' if flag else 'No')

Solution (Python):

S = list(input())
T = list(input())
dic_S = {}
dic_T = {}

for str in S:
    if str not in dic_S:
        dic_S[str] = 1
    else:
        dic_S[str] += 1
S = list(dic_S.values())
S.sort()

for str in T:
    if str not in dic_T:
        dic_T[str] = 1
    else:
        dic_T[str] += 1
T = list(dic_T.values())
T.sort()

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

Solution (Python):
S = raw_input()
T = raw_input()

d = {}
z = {}
flag = True
for i in range(len(S)):
    if S[i] not in d:
        d[S[i]] = T[i]
        z[T[i]] = S[i]
    if d[S[i]] != T[i]:
        flag = False

for k in d:
    if z[d[k]] != k:
        flag = False

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

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

def f(U):
    U2 = []
    for u in list(U):
        if u not in U2:
            U2.append(u)
    h = {}
    i = ord('a')
    for u in U2:
        h[u] = chr(i)
        i += 1
    U3 = ''
    for u in list(U):
        U3 += h[u]
    return U3


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

Solution (Python):


s = input()
t = input()
size = len(s)

s_list = [0] * size
t_list = [0] * size

for i in range(size):
  s_list[i] = s.index(s[i])
  t_list[i] = t.index(t[i])

if s_list == t_list:
  print("Yes")
else:
  print("No")

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


s_to_t = {}
t_to_s = {}

for i in range(len(s)):
    if s[i] not in s_to_t:
        if t[i] not in t_to_s:
            s_to_t[s[i]] = t[i]
            t_to_s[t[i]] = s[i]
            continue
        else:
            print('No')
            exit(0)
    elif s_to_t[s[i]] == t[i] and t_to_s[t[i]] == s[i]:
        continue
    else:
        print('No')
        exit(0)
        
print('Yes')

Solution (Python):
def make_reverse_index(s):
    idx = dict()

    for pos, c in enumerate(s):
        if c not in idx:
            idx[c] = list()
        idx[c].append(pos)

    return idx

def solve(s, t):
    idx1 = make_reverse_index(s)
    idx2 = make_reverse_index(t)

    for i1 in idx1.values():
        c2 = t[i1[0]]
        i2 = idx2[c2]

        if i1 != i2:
            return False

    return True

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

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

main()

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

a_cache = dict()
b_cache = dict()

a_unique = 0
b_unique = 0
for n in range(len(a)):
    
    a_char = a[n]
    b_char = b[n]

    if a_char in a_cache:
        a_n_unique = a_cache[a_char]
    else:
        a_n_unique = a_unique
        a_cache[a_char] = a_unique
        a_unique += 1

    if b_char in b_cache:
        b_n_unique = b_cache[b_char]
    else:
        b_n_unique = b_unique
        b_cache[b_char] = b_unique
        b_unique += 1
    
    if a_n_unique != b_n_unique:
        print("No")
        exit(0)

print("Yes")

Solution (Python):



s = input()
t = input()

cslist = []
slist = []

ctlist = []
tlist = []
for x in t:
    if x in ctlist:
        pass
    else:
        tlist.append(t.count(x))
        ctlist.append(x)

for y in s:
    if y in cslist:
        pass
    else:
        slist.append(s.count(y))
        cslist.append(y)


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

Solution (Python):
src = input()
dest = input()

if len(src) != len(dest):
    print("No")
    exit()




src = src.upper()

for i in range(len(src)):
    if src[i].islower():
        pass
    elif dest[i] in src[0:i]:
        print('No')
        exit()
    else:
        src = src.replace(src[i], dest[i])

if src == dest:
    print("Yes")
else:
    print("No")