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=input()
T=input()
a=["a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"]
A=["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"]
count=0
for i in range(len(S)):
    if S[i] in a:
        S=S.replace(S[i],A[count])
        count+=1
        
cnt=0
for j in range(len(T)):
    if T[j] in a:
        T=T.replace(T[j],A[cnt])
        cnt+=1

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

Solution (Python):

S = input()
T = input()

alphabet_S = [0]*27
alphabet_T = [0]*27
for i in range(len(S)):
	alphabet_S[ord(S[i])-ord('a')] += 1
	alphabet_T[ord(T[i])-ord('a')] += 1

alphabet_S.sort()
alphabet_T.sort()

if alphabet_S == alphabet_T:
	print('Yes')
else:
	print('No')

Solution (Python):
s = input()
t = input()
dt = {}
ds = {}
for i in range(len(s)):
    if t[i] in dt:
        if dt[t[i]] != s[i]:
            print("No")
            exit()
    else:
        dt[t[i]] = s[i]
    if s[i] in ds:
        if ds[s[i]] != t[i]:
            print("No")
            exit()
    else:
        ds[s[i]] = t[i]
print("Yes")

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

d = [{},{}]

f=True

for s,t in zip(S,T):
    if t not in d[0]:
        d[0][t] = s
    else:
        if d[0][t] != s:
            f = False
            break
    if s not in d[1]:
        d[1][s] = t
    else:
        if d[1][s] != t:
            f = False
            break
if f:
    print('Yes')
else:
    print('No')

Solution (Python):
import numpy as np,math,itertools



def func(n:str):
   b=[]
   ll=[]
   for i in n:
      if not i in b:
         b+=[i]
      ll+=[b.index(i)]
   return ll


s=input()
t=input()
rs=False

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

Solution (Python):
def con(s):
    li = list(s)
    out=[0]*len(li)
    cnt=0
    t={}
    for i in range(len(li)):
        if li[i] in t.keys():
            out[i] = t[li[i]]
        else:
            out[i] = cnt 
            t[li[i]] = cnt
            cnt += 1
    return out

s = input()
t = input()

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

Solution (Python):
S=input()
T=input()
dic={}
ans='Yes'
for i,x in enumerate(S):
    if dic.get(x,'')=='':
        dic[x]=T[i]
    elif dic[x]!=T[i]:
        ans='No'
        break
dic2={}
for i,x in enumerate(T):
    if ans=='No':
        break
    if dic2.get(x,'')=='':
        dic2[x]=S[i]
    elif dic2[x]!=S[i]:
        ans='No'
        break
print(ans)

Solution (Python):
from sys import stderr
from functools import reduce
from collections import defaultdict as dd
from operator import add


def f():
    return [int(i) for i in input().split()]


def yes(n):
    print("Yes" if n else "No")


def debug(*x, sep=" ", end="\n"):
    for item in x:
        stderr.write(str(item))
        stderr.write(sep)
    stderr.write(end)


s = input()
t = input()
pos_s = dd(list)
pos_t = dd(list)

for i, char in enumerate(s):
    pos_s[char].append(i)
for i, char in enumerate(t):
    pos_t[char].append(i)

for key_s, item_s in pos_s.items():
    for key_t, item_t in pos_t.items():
        if item_s == item_t:
            pos_s[key_s] = []
            pos_t[key_t] = []

yes(
    all([len(p) == 0 for p in pos_s.values()]) and all([len(p) == 0 for p in pos_t.values()]))

Solution (Python):
str1 = input()
str2 = input()

array1 = []
array2 = []

for i in range(97, 97+26):
    array1.append(str1.count(chr(i)))
    array2.append(str2.count(chr(i)))

for p in range(len(str1)):
    if(array1.count(p) != array2.count(p)):
        print("No")
        exit()

print("Yes")

Solution (Python):
al="abcdefghijklmnopqrstuvwxyz"
D1={}
D2={}
for i in range(26):
    D1[al[i]]=0
    D2[al[i]]=0



s=input()
t=input()

n=0
for i in range(len(s)):
    if (D1[s[i]]!=0 and D1[s[i]]!=t[i]) or (D2[t[i]]!=0 and D2[t[i]]!=s[i]) :
        n=1
        
    else:
        D1[s[i]]=t[i]
        D2[t[i]]=s[i]

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

Solution (Python):
s=list(input())	
t=list(input())	
def c(l, x):
    return [i for i, _x in enumerate(l) if _x == x]
ss = []
tt = []
ss.append(c(s,'a'))
tt.append(c(t,'a'))
ss.append(c(s,'b'))
tt.append(c(t,'b'))
ss.append(c(s,'c'))
tt.append(c(t,'c'))
ss.append(c(s,'d'))
tt.append(c(t,'d'))
ss.append(c(s,'e'))
tt.append(c(t,'e'))
ss.append(c(s,'f'))
tt.append(c(t,'f'))
ss.append(c(s,'g'))
tt.append(c(t,'g'))
ss.append(c(s,'h'))
tt.append(c(t,'h'))
ss.append(c(s,'i'))
tt.append(c(t,'i'))
ss.append(c(s,'j'))
tt.append(c(t,'j'))
ss.append(c(s,'k'))
tt.append(c(t,'k'))
ss.append(c(s,'l'))
tt.append(c(t,'l'))
ss.append(c(s,'m'))
tt.append(c(t,'m'))
ss.append(c(s,'n'))
tt.append(c(t,'n'))
ss.append(c(s,'o'))
tt.append(c(t,'o'))
ss.append(c(s,'p'))
tt.append(c(t,'p'))
ss.append(c(s,'q'))
tt.append(c(t,'q'))
ss.append(c(s,'r'))
tt.append(c(t,'r'))
ss.append(c(s,'s'))
tt.append(c(t,'s'))
ss.append(c(s,'t'))
tt.append(c(t,'t'))
ss.append(c(s,'u'))
tt.append(c(t,'u'))
ss.append(c(s,'v'))
tt.append(c(t,'v'))
ss.append(c(s,'w'))
tt.append(c(t,'w'))
ss.append(c(s,'x'))
tt.append(c(t,'x'))
ss.append(c(s,'y'))
tt.append(c(t,'y'))
ss.append(c(s,'z'))
tt.append(c(t,'z'))
ss.sort()
tt.sort()


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

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

k = "abcdefghijklmnopqrstuvwxyz"
D_S = dict((c, []) for c in k)
D_T = dict((c, []) for c in k)

for i in range(len(S)):
    D_S[S[i]].append(i)
    D_T[T[i]].append(i)

for v_s in D_S.values():
    if v_s in D_T.values():
        continue
    print("No")
    break
else:
    print("Yes")

Solution (Python):
il = lambda: list(map(int, input().split()))
ils = lambda n, s="int(input())": [eval(s) for _ in range(n)]

s = input()
t = input()
S = ""
T = ""

se = dict()
cnt = 0
for j in s:
    if not(j in se.keys()):
        se[j] = cnt
        cnt += 1
    S += str(se[j])

se = dict()
cnt = 0
for j in t:
    if not(j in se.keys()):
        se[j] = cnt
        cnt += 1
    T += str(se[j])

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

Solution (Python):
import numpy as np
import math






S = input() 
T = input() 

StoT = dict()
TtoS = dict()

for i, _ in enumerate(S):
    if S[i] not in StoT:
        if T[i] in TtoS and TtoS[T[i]] != S[i]:
            print('No')
            exit(0)
        StoT[S[i]] = T[i]
        TtoS[T[i]] = S[i]
    else:        
        
        
        if StoT[S[i]] != T[i]:
            print('No')
            exit(0)

print('Yes')

Solution (Python):

S = input()
T = input()

N = len(S)

d_s = {}
d_t = {}

S_i = []
T_i = []
for s, t in zip(S, T):
    if s in d_s.keys():
        S_i += [d_s[s]]
    else:
        d_s[s] = len(d_s)
        S_i += [d_s[s]]

    if t in d_t.keys():
        T_i += [d_t[t]]
    else:
        d_t[t] = len(d_t)
        T_i += [d_t[t]]

if S_i == T_i:
    print("Yes")
else:
    print("No")

Solution (Python):
def slve():
	a = input()
	b = input() 
	a_chars = {}
	b_chars = {}

	for i in a:
		if i not in a_chars:
			a_chars[i] = 1
		else:
			a_chars[i] += 1

	for i in b:
		if i not in b_chars:
			b_chars[i] = 1
		else:
			b_chars[i] += 1

	a_l = [v for (k,v) in a_chars.items()]
	b_l = [v for (k,v) in b_chars.items()]
	a_l.sort()
	b_l.sort()
	for i in range(len(a_l)):
		if a_l[i] != b_l[i]:
			print("No")
			return 

	print("Yes")


slve()

Solution (Python):
S = list(input())
T = list(input())
check = [[] for i in range(26)]
for i in range(len(T)):
    check[ord(T[i]) - 97].append(i)
ans = 1
for i in check:
    for j in range(1, len(i)):
        if S[i[j]] != S[i[j - 1]]:
            ans = -1
            break
        
check = [[] for i in range(26)]
for i in range(len(S)):
    check[ord(S[i]) - 97].append(i)
for i in check:
    for j in range(1, len(i)):
        if T[i[j]] != T[i[j - 1]]:
            ans = -1
            break
if ans == 1:
    print("Yes")
else:
    print("No")

Solution (Python):
import collections
S = input()
T = input()
sc = sorted(collections.Counter(S).values())
tc = sorted(collections.Counter(T).values())

if sc == tc:
    print("Yes")
else:
    print("No")

Solution (Python):
ai = lambda: list(map(int, input().split()))
ai_ = lambda: [int(x) - 1 for x in input().split()]

s = input()
t = input()

import string
S = string.ascii_lowercase

ss = [[] for _ in range(26)]
for i in range(26):
    for j in range(len(s)):
        if S[i] == s[j]:
            ss[i].append(j)
ss = [tuple(k) for k in ss]


tt = [[] for _ in range(26)]
for i in range(26):
    for j in range(len(s)):
        if S[i] == t[j]:
            tt[i].append(j)
tt = [tuple(k) for k in tt]


from collections import Counter
if Counter(ss) == Counter(tt):
    print('Yes')
else:
    print('No')

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

sdic={}
snum=""
for i in s:
    if i not in sdic:
        sdic[i]=len(sdic)
        snum+=str(sdic[i])
    else:
        snum+=str(sdic[i])

tdic={}
tnum=""
for i in t:
    if i not in tdic:
        tdic[i]=len(tdic)
        tnum+=str(tdic[i])
    else:
        tnum+=str(tdic[i])




if snum==tnum:
    print("Yes")
else:
    print("No")

Solution (Python):
msg=input()
patten=input()

bucket=[None,None]
bucket[0]=[0]*26
bucket[1]=[0]*26
for c in msg:
    bucket[0][ord(c)-ord('a')]+=1
for c in patten:
    bucket[1][ord(c)-ord('a')]+=1
bucket[0]=sorted(bucket[0])
bucket[1]=sorted(bucket[1])
winFlag=True
for i in range(len(bucket[0])):
    if(bucket[0][i]!=bucket[1][i]):
        winFlag=False
if winFlag==False:
    print("No")
else:
    print("Yes")

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

s_dict = {}
for i in S:
    if not i in s_dict.keys():
        s_dict[i] = 1
    else:
        s_dict[i] += 1

t_dict = {}
for i in T:
    if not i in t_dict.keys():
        t_dict[i] = 1
    else:
        t_dict[i] += 1

if sorted(s_dict.values()) == sorted(t_dict.values()):
    print('Yes')
else:
    print('No')

Solution (Python):
s=raw_input()
t=raw_input()
m={}
ret = "Yes"
for i,c in enumerate(s):
  if c in m and m[c]!=t[i]:ret = "No"
  m[c] = t[i]
if len(set(m[c] for c in m))!=len(m):ret = "No"
print ret

Solution (Python):
S = input()
T = input()
smap = {}
tmap = {}
replaceS = []
replaceT = []
n = 'a'
for c in S:
  if c not in smap:
    smap[c] = n
    n = chr(ord(n)+1)
  replaceS.append(smap[c])

n = 'a'
for c in T:
  if c not in tmap:
    tmap[c] = n
    n = chr(ord(n)+1)
  replaceT.append(tmap[c])

if ''.join(replaceS) == ''.join(replaceT) \
  and len(smap.keys()) == len(tmap.keys()):
  print('Yes')
else:
  print('No')

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

c_set = set()
for c in s:
    c_set.add(c)

t_set = set()
for c in c_set:
    isFirst = True
    tTemp = ""

    for i in range(len(s)):
        if isFirst:
            if s[i] == c:
                tTemp = t[i]
                isFirst = False
                if tTemp in t_set:
                    print("No")
                    exit()
                t_set.add(tTemp)
        else:
            if s[i] == c:
                if t[i] != tTemp:
                    print("No")
                    exit()

print("Yes")

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

used = []
res = []
for i in range(len(s)):
    if s[i] not in used:
        used.append(s[i])
    res.append(used.index(s[i]))
used = []
ret = []
for i in range(len(t)):
    if t[i] not in used:
        used.append(t[i])
    ret.append(used.index(t[i]))
if res == ret:
    print('Yes')
else:
    print('No')

Solution (Python):
from sys import stdin
a = stdin.readline().strip()
b = stdin.readline().strip()
ans = 'Yes'
di = {} 
hi = {}
n = len(a)
for i in xrange(n):
    if a[i] in di and di[a[i]]!=b[i]:
        ans = 'No'
        break 
    if b[i] in hi and hi[b[i]]!=a[i]:
        ans = 'No'
        break 
    hi[b[i]] = a[i]
    di[a[i]] = b[i] 
print ans

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

list_a_z = [chr(i) for i in range(97, 97+26)]

flag = True

for a in list_a_z:
    try:
        i = S.index(a)
        b = T[i]
        if [s == a for s in S] != [t == b for t in T]:
            flag = False
            break
    except:
        pass

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

Solution (Python):
S = input()
T = input()
U = "abcdefghijklmnopqrstuvwxyz"
s = [0 for k in range(26)]
t = [0 for k in range(26)]

for k in range(26):
    s[k] += S.count(U[k])
    t[k] += T.count(U[k])
print("Yes" if sorted(s)==sorted(t) else "No")

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

cntS = Counter(S).most_common()
cntT = Counter(T).most_common()

Ans = "Yes"
if len(cntS)==len(cntT):
    for i in range(len(cntT)):
        if cntS[i][1] != cntT[i][1]:
            Ans = "No"
else:
    Ans = "No"

print(Ans)

Solution (Python):
from collections import defaultdict
S = input()
T = input()
DS = defaultdict(int)
for s in S:
  DS[s] += 1
CS = sorted(DS.values())
DT = defaultdict(int)
for t in T:
  DT[t] += 1
CT = sorted(DT.values())
if len(CS) == len(CT):
  for i in range(len(CS)):
    if CS[i] != CT[i]:
      print('No')
      break
  else:
    print('Yes')
else:
  print('No')

Solution (Python):
S = input()
T = input()
L = [chr(i) for i in range(97, 97+26)]
countS = []
countT = []
for x in L:
    countS.append(S.count(x))
    countT.append(T.count(x))
countS.sort()
countT.sort()
if countS == countT:
    print('Yes')
else:
    print('No')

Solution (Python):
S =input()
T =input()
convert_dict = {}

for i,s in enumerate(S):
    t = T[i]
    if s not in convert_dict:
        convert_dict[s]=t
    else:
        if convert_dict[s]==t:
            continue
        print("No")
        exit()


if not len(convert_dict.keys()) == len(set(convert_dict.values())):
    print("No")
else:
    print("Yes")

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

LISTS=[[] for i in range(30)]
LISTT=[[] for i in range(30)]

for i in range(L):
    LISTS[ord(S[i])-97].append(i)
    LISTT[ord(T[i])-97].append(i)


check=1
for i in range(30):
    if len(LISTS[i])>=2:
        for j in range(1,len(LISTS[i])):
            if T[LISTS[i][j]]!=T[LISTS[i][j-1]]:
                check=0


    if len(LISTT[i])>=2:
        for j in range(1,len(LISTT[i])):
            if S[LISTT[i][j]]!=S[LISTT[i][j-1]]:
                check=0

if check==1:
    print("Yes")

else:
    print("No")

Solution (Python):
from collections import Counter as C
print(["No", "Yes"][C(C(input()).values()) == C(C(input()).values())])

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

dct = {}

for x, y in zip(S, T):
    if x in dct.keys():
        if dct[x] != y:
            print("No")
            sys.exit()
    dct[x] = y

if len(set(dct.keys())) != len(set(dct.values())):
    print("No")
else:
    print("Yes")

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

c_s = sorted([s.count(_c) for _c in set(s)])
c_t = sorted([t.count(_c) for _c in set(t)])

if c_s == c_t:
    print("Yes")
else:
    print("No")

Solution (Python):
from collections import defaultdict

S = input()
T = input()

ds = defaultdict(set)
for k, c in enumerate(S):
    ds[c] |= {k}
dt = defaultdict(set)
for k, c in enumerate(T):
    dt[c] |= {k}

dss = set(tuple(x) for x in ds.values())
dts = set(tuple(x) for x in dt.values())

print('Yes' if dss ^ dts == set() else 'No')

Solution (Python):
s=input()
t=input()
import collections
cs=collections.Counter(list(s))
ct=collections.Counter(list(t))
a,b=list(cs.values()),list(ct.values())
a.sort()
b.sort()
print("Yes" if a==b else "No")

Solution (Python):
S = input()
T = input()
Ls = [0]*26
Lt = [0]*26
for s in S:
    Ls[ord(s)-97] += 1
for t in T:
    Lt[ord(t)-97] += 1
Ls.sort()
Lt.sort()
if Ls==Lt:
    print("Yes")
else:
    print("No")

Solution (Python):
from collections import Counter

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

SS = Counter(S)
TT = Counter(T)

SS = list(SS.values())
SS.sort()

TT = list(TT.values())
TT.sort()

if SS == TT:
    print("Yes")
else:
    print("No")

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

ms = {}
mt = {}
for i in range(len(S)):
    if S[i] in ms.keys() and ms[S[i]] != T[i]:
        print('No')
        exit()

    if T[i] in mt.keys() and mt[T[i]] != S[i]:
        print('No')
        exit()

    ms[S[i]] = T[i]
    mt[T[i]] = S[i]

print('Yes')

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

dicta = dict()
dictb = dict()

for i in a:
	if i not in dicta:
		dicta[i] = 1
	else:
		dicta[i] += 1
	
for i in b:
	if i not in dictb:
		dictb[i] = 1
	else:
		dictb[i] += 1
		
		
if sorted(dicta.values()) == sorted(dictb.values()):
	print ('Yes')
else:
	print ('No')

Solution (Python):
s = str(input())
t = str(input())
lis = [0 for i in range(26)]
li = [0 for i in range(26)]
for i in range(len(s)):
  lis[ord(s[i])-ord("a")] += 1
  li[ord(t[i])-ord("a")] += 1
lis.sort()
li.sort()
for i in range(26):
  if lis[i] != li[i]:
    print("No")
    exit()
print("Yes")

Solution (Python):
def solve(s, t):
    dic1, dic2 = {}, {}
    for c, d in zip(s, t):
        if c in dic1:
            if dic1[c] != d:
                return False
        else:
            dic1[c] = d
        if d in dic2:
            if dic2[d] != c:
                return False
        else:
            dic2[d] = c
    return True


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

Solution (Python):
import sys
S = input()
T = input()
a = []
b = []
i = 0
while i < len(S):
  if S[i] in a:
    if T[i] in b and a.index(S[i]) == b.index(T[i]):
      pass
    else:
      print('No')
      sys.exit()
  else:
    if T[i] in b:
      print('No')
      sys.exit()
    else:
      a.append(S[i])
      b.append(T[i])
  i += 1
print('Yes')

Solution (Python):
import sys
stdin = sys.stdin

def li(): return map(int, stdin.readline().split())
def li_(): return map(lambda x: int(x)-1, stdin.readline().split())
def lf(): return map(float, stdin.readline().split())
def ls(): return stdin.readline().split()
def ns(): return stdin.readline().rstrip()
def lc(): return list(ns())
def ni(): return int(stdin.readline())
def nf(): return float(stdin.readline())

from collections import Counter

s = ns()
t = ns()

cnt_s = Counter(s)
cnt_t = Counter(t)

val_s = sorted(list(cnt_s.values()))
val_t = sorted(list(cnt_t.values()))

if val_s == val_t:
    print("Yes")
else:
    print("No")

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

P = set()
Q = set()

def conv(S):
    MS = {}
    idx = 0
    res = []
    for s in S:
        if s in MS:
            res.append(MS[s])
            continue
        MS[s] = idx
        res.append(idx)
        idx += 1
    return res

MS = conv(S)
MT = conv(T)

if MS == MT:
    print('Yes')
else:
    print('No')

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

alphas = [chr(i) for i in range(97,97+26)]

dics = {}
for a in alphas:
    dics[a] = s.count(a)
    s = s.replace(a, str(dics[a]))

dic_t = {}
for a in alphas:
    dic_t[a] = t.count(a)
    t = t.replace(a, str(dic_t[a]))

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

Solution (Python):
from collections import defaultdict

s = input()
t = input()

s_dict = defaultdict(int)
for char in s:
    s_dict[char] += 1

t_dict = defaultdict(int)
for char in t:
    t_dict[char] += 1

if sorted(s_dict.values()) == sorted(t_dict.values()):
    print("Yes")
else:
    print("No")

Solution (Python):
def f(S):
  M = {}
  for s in S:
    if s not in M:
      M[s] = chr(ord("a")+len(M))
  return "".join(M[s] for s in S)

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

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

def to_num_list(s):
    seen = {}
    ret = []
    idx = 0
    for ch in s:
        if ch not in seen:
            seen[ch] = idx
            idx += 1
        ret.append(seen[ch])
    return ret

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

Solution (Python):
from collections import Counter

S = input()
T = input()

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

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