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()

s_inf = [[] for _ in range(97+26+1)]
t_inf = [[] for _ in range(97+26+1)]

for i in range(len(s)):
    s_inf[ord(s[i])].append(i)
    t_inf[ord(t[i])].append(i)
s_inf.sort()
t_inf.sort()
if s_inf==t_inf:
    print("Yes")
else:
    print("No")

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

s = sorted([s.count(i) for i in set(s)])
t = sorted([t.count(i) for i in set(t)])

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

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

s = sorted([s.count(i) for i in set(s)])
t = sorted([t.count(i) for i in set(t)])

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

Solution (Python):
ds, dt = dict(), dict()
for s, t in zip(input(), input()):
    if t in ds and ds[t] != s or s in dt and dt[s] != t:
        print("No")
        break
    ds[t] = s
    dt[s] = t
else:
    print("Yes")

Solution (Python):
import collections
s = input()
t = input()
s_cnt = collections.Counter(s)
t_cnt = collections.Counter(t)
a = s_cnt.most_common()
b = t_cnt.most_common()
ans = True
for i in range(len(a)):
    if a[i][1] != b[i][1]:
        ans = False
        break

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

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

converter = dict()

for s, t in zip(S, T):
    if converter.get(s) is not None:
        if converter[s] != t:
            print("No")
            break
    else:
        converter[s] = t
else:
    if len(converter.values()) != len(set(converter.values())):
        print("No")
    else:
        print("Yes")

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


converter = dict()

for s, t in zip(S, T):
    
    if converter.get(s) is not None:
        if converter[s] != t:
            print('No')
            break
    else:
        converter[s] = t




else:  
    if len(converter.values()) != len(set(converter.values())):
        print('No')
    else:
        print('Yes')

Solution (Python):
S = list(input())
T = list(input())
s = []
t = []
s_num = []
t_num = []
for Si, Ti in zip(S, T):
    if not Si in s:
        s.append(Si)
    if not Ti in t:
        t.append(Ti)
for Si, Ti in zip(S, T):
    s_num.append(str(s.index(Si)))
    t_num.append(str(t.index(Ti)))






if ''.join(s_num) == ''.join(t_num):
    print('Yes')
else:
    print('No')

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

def calculate(s, t):
    dictS = {}
    dictT = {}

    for ss in s:
        if dictS.get(ss) == None:
            dictS.__setitem__(ss, 1)
        else:
            dictS.__setitem__(ss, dictS.get(ss) + 1)

    for tt in t:
        if dictT.get(tt) == None:
            dictT.__setitem__(tt, 1)
        else:
            dictT.__setitem__(tt, dictT.get(tt) + 1)

    sValues = dictS.values()
    tValues = dictT.values()

    sNums = {}
    tNums = {}


    for value in sValues:
        if sNums.get(value) == None:
            sNums.__setitem__(value,1)
        else:
            sNums.__setitem__(value,sNums.get(value) + 1)

    for value in tValues:
        if tNums.get(value) == None:
            tNums.__setitem__(value,1)
        else:
            tNums.__setitem__(value,tNums.get(value) + 1)

    if (sNums == tNums):
        print("Yes")
    else:
        print("No")

calculate(S, T)

Solution (Python):
from collections import defaultdict
d = defaultdict(str)
k = defaultdict(str)

S = input()
T = input()

ans = "Yes"

for i in range(len(S)):
  if d[S[i]] and d[S[i]] != T[i]:
    ans = 'No'
    break

  if k[T[i]] and k[T[i]] != S[i]:
    ans = 'No'
    break

  d[S[i]] = T[i]
  k[T[i]] = S[i]

print(ans)

Solution (Python):
alphabetlist=['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']

S=input()
T=input()
Sdata=[[] for i in range(0,26)]
Tdata=[[] for i in range(0,26)]

for i in range(0,len(S)):
    Sdata[alphabetlist.index(S[i])].append(i)
for i in range(0,len(T)):
    Tdata[alphabetlist.index(T[i])].append(i)
Sdata.sort()
Tdata.sort()
if Sdata==Tdata:
    print('Yes')
else:
    print('No')

Solution (Python):
from collections import defaultdict
s = input()
t = input()
d = defaultdict(str)
e = defaultdict(str)
for i in range(len(s)):
    c1,c2 = s[i],t[i]
    if d[c1] == "":
        d[c1] = c2
    elif d[c1] != c2:
        print("No")
        exit(0)
    if e[c2] == "":
        e[c2] = c1
    elif e[c2] != c1:
        print("No")
        exit(0)
print("Yes")

Solution (Python):

if __name__ == '__main__':
    S=input()
    T=input()
    MA={}
    IMA={}
    ok=True
    for i in range(len(S)):
        s=S[i]
        t=T[i]
        if list(MA.keys()).count(s)>0:
            if MA[s]!=t:
                ok=False
        if list(IMA.keys()).count(t) > 0:
            if IMA[t] != s:
                ok = False
        MA[s]=t
        IMA[t]=s
    if ok:
        print("Yes")
    else:
        print("No")

Solution (Python):
smap, tmap = [-1] * 26, [-1] * 26

S = input()
T = input()

ans = 'Yes'
for s, t in zip(S, T):
    s = ord(s) - ord('a')
    t = ord(t) - ord('a')
    if smap[s] >= 0:
        if smap[s] != t:
            ans = 'No'
            break
    else:
        smap[s] = t
    if tmap[t] >= 0:
        if tmap[t] != s:
            ans = 'No'
            break
    else:
        tmap[t] = s
    
print(ans)

Solution (Python):
S, T = [0] * 26, [0] * 26

for s in input():
    S[ord(s) - ord('a')] += 1
for t in input():
    T[ord(t) - ord('a')] += 1
S.sort()
T.sort()
ans = 'Yes' if S == T else 'No'
print(ans)

Solution (Python):
from collections import Counter
cs=Counter(input())
cn=Counter(input())
cs=sorted(cs.values())
cn=sorted(cn.values())
print("Yes") if (cs==cn) else print("No")

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

    dic={}
    for i in range(n):
        if s[i] not in dic:
            dic[s[i]]=t[i]
        else:
            if dic[s[i]]!=t[i]:
                print('No')
                exit()
    if len(set(dic.values()))!=len(dic.values()):
        print('No')
    else:
        print('Yes')
if __name__=='__main__':
    main()

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

st = {s: set() for s in set(S)}
ts = {t: set() for t in set(T)}
for i in range(len(S)):
    st[S[i]].add(T[i])
    ts[T[i]].add(S[i])

for vs, vt in zip(st.values(), ts.values()):
    if len(vs) > 1 or len(vt) > 1:
        print('No')
        break
else:
    print('Yes')

Solution (Python):
import collections

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

sc = collections.Counter(S)
tc = collections.Counter(T)

scv = sorted(sc.values())
tcv = sorted(tc.values())

if scv == tcv:
    print('Yes')
else:
    print('No')

Solution (Python):
class Solution:
    def solve(self, S: str, T: str) -> str:

        def str2pattern(S: str) -> str:
            swap = {}
            a = ord('a')
            pattern = ""
            for s in S:

                if not s in swap:
                    swap[s] = chr(a)
                    a += 1

                pattern += swap[s]

            return pattern

        if str2pattern(S) == str2pattern(T):
            return "Yes"
        else:
            return "No"


if __name__ == '__main__':

    
    S = input()
    T = input()

    
    solution = Solution()
    print(solution.solve(S, T))

Solution (Python):
from operator import itemgetter
s=input()
t=input()
u=[]
v=[]
s_len=len(s)
for i in range(s_len):
    s_i=s[i]
    t_i=t[i]
    ts=t_i+s_i
    if s_i!=t_i:
        if ts not in u:
            u.append(ts)
    elif s_i not in v:
        v.append(s_i)
u_len=len(u)
ans="Yes"
if u_len!=0:
    u1=sorted(u)
    u1.append("XX")
    for i in range(u_len):
        if u1[i][0] in v or u1[i][1] in v:
            ans="No"
            break
        elif u1[i][0]==u1[i+1][0] and u1[i][1]!=u1[i+1][1]:
            ans="No"
            break
    if ans=="Yes":
        u2=sorted(u,key=itemgetter(1))
        u2.append("XX")
        for i in range(u_len):
            if u2[i][0]!=u2[i+1][0] and u2[i][1]==u2[i+1][1]:
                ans="No"
                break
print(ans)

Solution (Python):
import sys
sys.setrecursionlimit(10**6)
from math import floor,ceil,sqrt,factorial,log
from heapq import heappop, heappush, heappushpop
from collections import Counter,defaultdict,deque
from itertools import accumulate,permutations,combinations,product,combinations_with_replacement
from bisect import bisect_left,bisect_right
from copy import deepcopy
from operator import itemgetter
from fractions import gcd
mod = 10 ** 9 + 7
inf = float('inf')
ninf = -float('inf')
 

def ii(): return int(sys.stdin.readline().rstrip()) 
def mii(): return map(int,sys.stdin.readline().rstrip().split())
def limii(): return list(mii()) 
def lin(n:int): return [ii() for _ in range(n)]
def llint(n: int): return [limii() for _ in range(n)]

def ss(): return sys.stdin.readline().rstrip() 
def mss(): return sys.stdin.readline().rstrip().split()
def limss(): return list(mss()) 
def lst(n:int): return [ss() for _ in range(n)]
def llstr(n: int): return [limss() for _ in range(n)]





s=list(ss())
t=list(ss())

cs=Counter(s)
ct=Counter(t)

ck=list(cs.values())
tk=list(ct.values())

ck.sort()
tk.sort()
if ck==tk:
    print("Yes")
else:
    print("No")

Solution (Python):

S=input()
T=input()
R={}
L={}
flg=True
for i in range(len(S)):
    if S[i] in R:
        if R[S[i]]!=T[i]: flg=False
    else:
        R[S[i]]=T[i]
    if T[i] in L:
        if L[T[i]]!=S[i]: flg=False
    else:
        L[T[i]]=S[i]
print('Yes' if flg else 'No')

Solution (Python):

s = input()
t = input()


alp = 'abcdefghijklmnopqrstuvwxyz'

scnt = [[] for i in range(28)]
tcnt = [[] for i in range(28)]

for i in range(len(s)):
    for j,v in enumerate(alp):
        if s[i] == v:
            scnt[j].append(i)

for i in range(len(t)):
    for j,v in enumerate(alp):
        if t[i] == v:
            tcnt[j].append(i)

scnt.sort()
tcnt.sort()


if scnt == tcnt:print("Yes")
else :print("No")

Solution (Python):
def main():
    S = input()
    T = input()
    ds = {}
    dt = {}
    for i, v in enumerate(S):
        if v in ds:
            ds[v].append(i)
        else:
            ds[v] = [i]
    for i, v in enumerate(T):
        if v in dt:
            dt[v].append(i)
        else:
            dt[v] = [i]
    for i in ds:
        l = ds[i]
        for j in dt:
            if l == dt[j]:
                break
        else:
            return 'No'
    return 'Yes'
print(main())

Solution (Python):
s = input()
t = input()
p = {}
q = {}
for i in range(len(s)):
    if s[i] in p and p[s[i]] != t[i]:
        print('No')
        exit(0)
    if t[i] in q and q[t[i]] != s[i]:
        print('No')
        exit(0)
    p[s[i]] = t[i]
    q[t[i]] = s[i]
print('Yes')

Solution (Python):
from collections import Counter
s = list(input())
t = list(input())

sc = Counter(s)
tc = Counter(t)

sc_l = sorted(sc.values())
tc_l = sorted(tc.values())

if sc_l == tc_l:
    print("Yes")
else:
    print("No")

Solution (Python):
import collections

s=list(input())
t=list(input())

ss=collections.Counter(s)
tt=collections.Counter(t)

s_v = sorted(ss.values())
t_v = sorted(tt.values())

if s_v == t_v:
    print("Yes")
else:
    print("No")

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

st=[]
ts=[]
for i in range(len(s)):
    st.append([s[i],t[i]])
    ts.append([t[i],s[i]])

st.sort()
ts.sort()

    
yesno="Yes"
for i in range(len(st)-1):
    sj,tj=st[len(st)-i-1]
    sk,tk=st[len(st)-i-2]
    if sj==sk and tj!=tk:
        yesno="No"
        break
    tj,sj=ts[len(ts)-i-1]
    tk,sk=ts[len(ts)-i-2]
    if tj==tk and sj!=sk:
        yesno="No"
        break
    
print(yesno)

Solution (Python):
def f():w=input();return sorted(w.count(c) for c in set(w))
print('YNeos'[f()!=f()::2])

Solution (Python):
def f(): w=input(); return sorted(w.count(c) for c in set(w))
s,t=f(),f()
print('YNeos'[s!=t::2])

Solution (Python):
def f():
  w = input()
  return sorted([w.count(c) for c in set(w)])
s,t = f(),f()
print('YNeos'[s!=t::2])

Solution (Python):
S, T = input(), input()
ma, ima = {}, {}
ok = True
for i in range(len(S)):
    s, t = S[i], T[i]
    if s in ma and ma[s] != t:
        ok = False
    if t in ima and ima[t] != s:
        ok = False
    ma[s] = t
    ima[t] = s
if ok:
    print("Yes")
else:
    print("No")

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

def chr_count(S):
    count = [0]*1000
    for i in S:
        count[ord(i)] += 1
    return count

Sc = chr_count(S)
Tc = chr_count(T)
Sc.sort()
Tc.sort()

if Sc == Tc:
    print("Yes")
else:
    print("No")

Solution (Python):
import collections


s = input()
t = input()
s = collections.Counter(s)
t = collections.Counter(t)

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

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

if len(set(S)) != len(set(T)):
    print("No")
    sys.exit()

record = {}
for i, s in enumerate(S):
    if s in record.keys():
        record[s].append(i)
    else:
        record[s] = [i]


def eq(x, t):
    if len(x) == 1:
        return 1
    for w in x[1:]:
        if t[w] == t[x[0]]:
            pass
        else:
            return 0
    return 1


ans = "Yes"
for i in record.values():
    if eq(i, T):
        pass
    else:
        ans = "No"
        break
print(ans)

Solution (Python):
import sys
sys.setrecursionlimit(4100000)
import math
import fractions
import bisect

MOD = int(1e9+7)
PI = 3.14159265358979323846264338327950288

'''
1行のint
N, K = map(int, input().split())

1行のstring
S, T = input().split()

1行の整数配列
P = list(map(int,input().split()))

改行ありl
x = []
y = []
for i in range(5):
    x1,y1=[int(i) for i in input().split()]
    x.append(x1)
    y.append(y1)

'''


S = input()
T = input()

s_hash = [0]*28
t_hash = [0]*28

s_next = 0
t_next = 0


for i in range(len(S)):

    if s_hash[ord(S[i])-ord("a")] !=  t_hash[ord(T[i])-ord("a")]:
        print("No")
        sys.exit()

    else:
        
        if s_hash[ord(S[i])-ord("a")] == 0:
            s_next+=1
        s_hash[ord(S[i])-ord("a")] += 1

        if t_hash[ord(T[i])-ord("a")] == 0:
            t_next+=1
        t_hash[ord(T[i])-ord("a")] += 1



print("Yes")

Solution (Python):
from collections import Counter


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

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

    a = sorted(list(s.values()))
    b = sorted(list(t.values()))

    print("Yes" if a == b else "No")


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

    
    s_to_t = {}
    t_to_s = {}

    for s, t in zip(S, T):
        if s not in s_to_t:
            s_to_t[s] = t
        else:
            if s_to_t[s] != t:
                print("No")
                exit()

        if t not in t_to_s:
            t_to_s[t] = s
        else:
            if t_to_s[t] != s:
                print("No")
                exit()

    print("Yes")


if __name__ == "__main__":
    main()

Solution (Python):
S = str(input())
T = str(input())
S_d = {}
T_d = {}
trans_d = {}
for i,j in zip(S,T):
    if i in S_d and j in T_d:
        if S_d[i] == T_d[j]:
            if trans_d[i] == j:
                pass
            else:
                print("No")
                break            
        else:
            print("No")
            break
    else:
        if i in S_d or j in T_d:
            print("No")
            break
        else:
            if S.count(S) == T.count(T):
                S_d[i] = S.count(S)
                T_d[j] = T.count(T)
                trans_d[i] = j
            else:
                print("No")
                break
        
else:
    print("Yes")

Solution (Python):
from collections import Counter

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

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

    a = sorted(list(s.values()))
    b = sorted(list(t.values()))

    print("Yes" if a == b else "No")


if __name__ == "__main__":
    main()

Solution (Python):
def convert(st):
    d = {}
    lst = []
    for ch in st:
        if ch not in d:
            d[ch] = len(d)
        lst.append(d[ch])
    return lst


S = input()
T = input()
Sl = convert(S)
Tl = convert(T)
print('Yes' if Sl == Tl else 'No')

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

Sd = {}
Sl = []
for c in S:
    if c not in Sd:
        Sd[c] = len(Sd)
    Sl.append(Sd[c])

Td = {}
Tl = []
for c in T:
    if c not in Td:
        Td[c] = len(Td)
    Tl.append(Td[c])

print('Yes' if Sl == Tl else 'No')

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

s_arr = [0] * 26
t_arr = [0] * 26
for i in range(len(s)):
    temp = ord(s[i])- ord('a')
    s_arr[temp] += 1
    temp = ord(t[i])- ord('a')
    t_arr[temp] += 1

s_arr.sort()
t_arr.sort()

ans = 'Yes'
for i in range(26):
    if s_arr[i] != t_arr[i]:
        ans = 'No'

print(ans)

Solution (Python):
s=input()
t=input()
S=sorted(map(s.count,set(s)))
T=sorted(map(t.count,set(t)))
print("Yes" if S==T else "No")

Solution (Python):
from collections import Counter
 
S=input()
T=input()
 
S=list(Counter(S).values())
T=list(Counter(T).values())
 
S.sort()
T.sort()
 
if S==T:
  print('Yes')
else:
    print('No')

Solution (Python):
S = input()
T = input()
R_s = [-1] * 26
R_t = [-1] * 26
ans = 'Yes'

for i in range(len(S)):
  tmpS = ord(S[i]) - 97
  tmpT = ord(T[i]) - 97
  if R_s[tmpS] < 0:
    R_s[tmpS] = tmpT
  elif R_s[tmpS] != tmpT:
    ans = 'No'
  
  if R_t[tmpT] < 0:
    R_t[tmpT] = tmpS
  elif R_t[tmpT] != tmpS:
    ans = 'No'

print(ans)

Solution (Python):
from heapq import heappush, heappop, heapify
from collections import deque, defaultdict, Counter
import itertools
from itertools import permutations, combinations, accumulate
import sys
import bisect
import string
import math
import time


def I(): return int(input())


def MI(): return map(int, input().split())


def S(): return input()


def MS(): return map(str, input().split())


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


def LI_(): return [int(i)-1 for i in input().split()]


def StoI(): return [ord(i)-97 for i in input()]


def ItoS(nn): return chr(nn+97)


def input(): return sys.stdin.readline().rstrip()


def show(*inp, end='\n'):
    if show_flg:
        print(*inp, end=end)


YN = {False: 'No', True: 'Yes'}
MOD = 10**9+7
inf = float('inf')
IINF = 10**10
l_alp = string.ascii_lowercase
u_alp = string.ascii_uppercase
ts = time.time()

nums = ['1', '2', '3', '4', '5', '6', '7', '8', '9', '10']


show_flg = True
show_flg = False


def main():
    s = S()
    t = S()
    s_pos = {k: set() for k in l_alp}
    t_pos = {k: set() for k in l_alp}

    for i in range(len(s)):
        s_pos[s[i]].add(i)
        t_pos[t[i]].add(i)

    for c in l_alp:
        loc = s_pos[c]
        candidates = set()
        for i in loc:
            candidates.add(t[i])

        if len(candidates) > 1:
            print('No')
            return

    for c in l_alp:
        loc = t_pos[c]
        candidates = set()
        for i in loc:
            candidates.add(s[i])

        if len(candidates) > 1:
            
            print('No')
            return

    print('Yes')


if __name__ == '__main__':
    main()

Solution (Python):
s=input()
t=input()
st={}
ts={}
for i in range(len(s)):
    if s[i] in st:
        if st[s[i]]!=t[i]:
            print("No")
            break
    else:
        st[s[i]]=t[i]
    if t[i] in ts:
        if ts[t[i]]!=s[i]:
            print("No")
            break
    else:
        ts[t[i]]=s[i]
    if i==len(s)-1:
        print("Yes")

Solution (Python):
s,t=input(),input()
import collections
c1=collections.Counter(s)
c2=collections.Counter(t)
if sorted(c1.values())==sorted(c2.values()):
    print('Yes')
else:
    print('No')

Solution (Python):
S = input()
T = input()
def f(x):
  d = {chr(97+i):[] for i in range(26)}
  for i in range(len(x)):
    d[x[i]].append(i)
  D = list(d.values())
  D.sort()
  return D
if f(S) == f(T):
  print("Yes")
else:
  print("No")

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

before = [-1] * 26
after = [-1] * 26

for i, j in zip(s, t):
    si = ord(i) - ord('a')
    ti = ord(j) - ord('a')

    if before[si] != -1 or after[ti] != -1:
        if before[si] != ti or after[ti] != si:
            print("No")
            exit()

    before[si] = ti
    after[ti] = si
print("Yes")

Solution (Python):
from collections import Counter
s = input()
t = input()

cnt_s = sorted(Counter(s).values())
cnt_t = sorted(Counter(t).values())
print('Yes' if cnt_s == cnt_t else 'No')

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

Ls=[0]*26
Lt=[0]*26

for i in range(len(S)):
    Ls[ord(S[i])-ord("a")]+=1
    Lt[ord(T[i])-ord("a")]+=1
    
Ls.sort()
Lt.sort()

flag=True
for i in range(len(Ls)):
    if Ls[i]!=Lt[i]:
        flag=False
        break
        
if flag:
    print("Yes")
else:
    print("No")

Solution (Python):
def checkTrans(s, t):
    ms = {}
    mt = {}
    for sc, tc in zip(s, t):
        if sc in ms:
            if ms[sc] != tc:
                return False
        else:
            ms[sc] = tc

        if tc in mt:
            if mt[tc] != sc:
                return False
        else:
            mt[tc] = sc

    return True

s = input()
t = input()

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

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

s_cnt=[]
t_cnt=[]

for i in range(97,97+26):
    s_cnt.append(S.count((chr(i))))
    t_cnt.append(T.count((chr(i))))

s_cnt.sort()
t_cnt.sort()

ok_flag=True
for i in range(len(s_cnt)):
    if s_cnt[i] != t_cnt[i]:
        ok_flag=False

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

Solution (Python):
from collections import Counter
s=input()
t=input()
cntS=list(Counter(s).values())
cntT=list(Counter(t).values())
cntS.sort()
cntT.sort()
print('Yes' if cntS==cntT else 'No')

Solution (Python):
import collections

S = input()
T = input()

reg = [None]*26
reg_flag = [0]*26

for i in range(len(S)):
    index = ord(S[i])-97
    if reg_flag[index] == 0:
        reg[index] = T[i]
        reg_flag[index] = 1

    if reg[index] != T[i]:
        print('No')
        exit()

reg = filter(lambda x: x != None, reg)
if collections.Counter(reg).most_common()[0][1] > 1:
    print('No')
else:
    print('Yes')

Solution (Python):
import collections

S = input()
T = input()

reg = [None]*26
reg_flag = [0]*26

for i in range(len(S)):
    index = ord(S[i])-97
    if reg_flag[index] == 0:
        reg[index] = T[i]
        reg_flag[index] = 1

    if reg[index] == T[i]:
        pass
    else:
        print('No')
        exit()

reg = filter(lambda x: x != None, reg)
if collections.Counter(reg).most_common()[0][1] > 1:
    print('No')
else:
    print('Yes')

Solution (Python):
def main():
    S = input()
    T = input()
    st = {}
    ts = {}
    for i in range(97, 97 + 26):
        st[chr(i)] = ""
        ts[chr(i)] = ""
    for s, t in zip(S, T):
        if st[s] == "":
            st[s] = t
        if ts[t] == "":
            ts[t] = s
        if not st[s] == t or not ts[t] == s:
            print("No")
            break
    else:
        print("Yes")


if __name__ == '__main__':
    main()

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

S1 = {}
for i, s in enumerate(S):
  if s in S1:
    S1[s].append(i)
  else:
    S1[s] = [i]
    
for str_key, keys in S1.items():
  t_str = []
  for k in keys:
    t_str.append(T[k])
  if len(set(t_str)) > 1:
    print('No')
    exit()
    
T1 = {}
for i, t in enumerate(T):
  if t in T1:
    T1[t].append(i)
  else:
    T1[t] = [i]
    
for str_key, keys in T1.items():
  s_str = []
  for k in keys:
    s_str.append(S[k])
  if len(set(s_str)) > 1:
    print('No')
    exit()
    
print('Yes')

Solution (Python):
def assert_(s, t):
    if s != t:
        print("No")
        exit()

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

    mapping = {}
    mapping_ = {}
    for i in range(len(S)):
        if S[i] in mapping:
            assert_(mapping[S[i]], T[i])
        if T[i] in mapping_:
            assert_(mapping_[T[i]], S[i])
        mapping[S[i]] = T[i]
        mapping_[T[i]] = S[i]
    print("Yes")

main()

Solution (Python):
from collections import Counter

S=input()
T=input()

S=list(Counter(S).values())
T=list(Counter(T).values())

S.sort()
T.sort()

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

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

d = {x: 0 for x in "abcdefghijklmnopqrstuvwxyz"}
e = {x: 0 for x in "abcdefghijklmnopqrstuvwxyz"}

for i in range(len(s)):
    if d[s[i]] == 0 and e[t[i]] == 0:
        d[s[i]] = t[i]
        e[t[i]] = s[i]
    else:
        if d[s[i]] != t[i] or e[t[i]] != s[i]:
            print("No")
            exit()
print("Yes")

Solution (Python):
S = input()
T = input()
 
alphabet = 'abcdefghijklmnopqrstuvwxyz'
 
S_list = []
T_list = []
 
for i in alphabet:
    Scnt = S.count(i)
    Tcnt = T.count(i)
    if Scnt > 0:
        S_list.append(Scnt)
    if Tcnt > 0:
        T_list.append(Tcnt)
 
if sorted(T_list) == sorted(S_list):
    print('Yes')
else:
    print('No')

Solution (Python):

import math
import heapq
import bisect
import numpy as np
from collections import Counter


S = input()
T = input()

dict = {}
re_dict = {}
flg = 1
for i in range(len(S)):
    if S[i] in dict:
        if T[i] != dict[S[i]]:
            flg = 0
            break
    else:
        dict[S[i]] = T[i]
        if T[i] in re_dict:
            if re_dict[T[i]] != S[i]:
                flg = 0
                break
        else:
            re_dict[T[i]] = S[i]

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

Solution (Python):
def normalized(s):
  indexes = {}
  def translated(ch):
    if ch not in indexes:
      indexes[ch] = len(indexes)
    return indexes[ch]

  return list(map(translated, s))


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

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


if __name__ == '__main__':
  main()

Solution (Python):
import sys

stdin = sys.stdin

mod = 1000000007
inf = 1 << 60

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip()
nas = lambda: stdin.readline().split()

from collections import OrderedDict

s = ns()
t = ns()
n = len(s)

ds = OrderedDict.fromkeys(s, 0)
dt = OrderedDict.fromkeys(t, 0)

for i in range(n):
    ds[s[i]] += 1

for i in range(n):
    dt[t[i]] += 1

flag = True
for i, j in zip(ds.values(), dt.values()):
    if i != j:
        flag = False

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

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

ok = True

RS = {}
RT = {}

for i in range(len(S)):
    s = S[i]
    t = T[i]
    if s in RS:
        if RS[s] != t:
            ok = False
    if t in RT:
        if RT[t] != s:
            ok = False
    RS[s] = t
    RT[t] = s
if ok:
    print('Yes')
else:
    print("No")

Solution (Python):
s = input()
t = input()
d_s = dict()
d_t = dict()
for i in range(len(s)):
  if not s[i] in d_s:
    d_s[s[i]] = t[i]
  elif d_s[s[i]] != t[i]:
    print('No')
    exit()
  if not t[i] in d_t:
    d_t[t[i]] = s[i]
  elif d_t[t[i]] != s[i]:
    print('No')
    exit()
print('Yes')

Solution (Python):
S=input()
T=input()
ng = 0
ds = {}
dt = {}
for i in range(len(S)):
    if S[i] in ds:
        if ds[S[i]] != T[i]:
            ng = 1
            break;
    else:
        ds[S[i]] = T[i]
    if T[i] in dt:
        if dt[T[i]] != S[i]:
            ng = 1
            break;
    else:
        dt[T[i]] = S[i]

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

Solution (Python):

import sys
import math
import os
import itertools
import _collections
import string

class cin():
    def int():
        return int(sys.stdin.readline().rstrip())
    def string():
        return sys.stdin.readline().rstrip()
    def mapInt():
        return [int(x) for x in cin.string().split()]
    def stringList(n):
        return [input() for i in range(n)]
    def intListList(n):
        return [cin.mapInt() for i in range(n)]

class Util():
    def roundUp(a,b):
        return -(-a // b)
    def toUpperMultiple(a,x):
        return Util.round_up(a,x) * x
    def toLowerMultiple(a,x):
        return (a // x) * x
class Math():
    def gcd(a,b):
        if b == 0:
            return a
        return Math.gcd(b,a % b)

S = cin.string()
T = cin.string()

def solve():
    X = _collections.defaultdict(lambda:"-1")
    Y = _collections.defaultdict(lambda:"-1")

    for i in range(len(S)):
        s = S[i]
        t = T[i]
        if X[s] != "-1" or Y[t] != "-1":
            if X[s] != t or Y[t] != s:
                return "No"
        X[s] = t
        Y[t] = s

    return "Yes"
print(solve())

Solution (Python):
import sys

use_clipboard=True
bbn=1000000007
	


def check(sc,tc):
	sc.sort()
	tc.sort()
	for u,v in zip(sc,tc):
		if len(u)!=len(v):
			return False
		for i,j in zip(u,v)	:
			if i!=j:
				return False
	return True
		
						
def main():
	s = input()
	t = input()
	c2i=lambda c : ord(c)-ord('a')
	sc=[[] for _ in range(26)]
	tc=[[] for _ in range(26)]
	
	for i,c in enumerate(s):
		
		sc[c2i(c)].append(i)
		
	for i,c in enumerate(t):
		tc[c2i(c)].append(i)
		
		
	ret = 'Yes' if check(sc,tc) else 'No'
	print(ret)
	
	

isTest=False

def pa(v):
	if isTest:
		print(v)


class input_clipboard:
	def __init__(self,s):
		self.input_l=s.splitlines()
		self.ii=0
		
	def input(self):
		ret = self.input_l[self.ii]
		self.ii+=1
		return ret


if __name__ == "__main__":
	if sys.platform =='ios':
		if use_clipboard:
			import clipboard
			input_text=clipboard.get()
			ic=input_clipboard(input_text)
			input = lambda : ic.input()
		else:
			sys.stdin=open('inputFile.txt')
		isTest=True
	else:
		pass
		
			
	ret = main()
	if ret is not None:
		print(ret)

Solution (Python):
s=list(input())
t=list(input())
s_r=["*"]
t_r=["*"]
s_ans=[]
t_ans=[]
for c in s:
  if c in s_r:
    s_ans.append(s_r.index(c))
  else:
    s_r.append(c)
    s_ans.append(len(s_r)-1)
for c in t:
  if c in t_r:
    t_ans.append(t_r.index(c))
  else:
    t_r.append(c)
    t_ans.append(len(t_r)-1)
print("Yes" if t_ans==s_ans else "No")

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

dic_s = dict()
dic_t = dict()

for ind, s in enumerate(S):
    if dic_s.get(s) is None:
        dic_s[s] = {ind}
    else:
        dic_s[s].add(ind)
for ind, t in enumerate(T):
    if dic_t.get(t) is None:
        dic_t[t] = {ind}
    else:
        dic_t[t].add(ind)

ans = 1
for s_key in dic_s:
    for t_key in dic_t:
        if dic_s[s_key] == dic_t[t_key]:
            break
    else:
        ans = 0
if ans:
    print("Yes")
else:
    print("No")