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):
small=list('abcdefghijklmnopqrstuvwxyz')
A=[0]*26
B=[0]*26
s=input()
t=input()
for i in range(26):
  A[i]=s.count(small[i])
  B[i]=t.count(small[i])
for i in range(len(s)):
  if A[small.index(s[i])]!=B[small.index(t[i])]:
    print('No')
    exit()
  else:
    A[small.index(s[i])]=-i-1
    B[small.index(t[i])]=-i-1
print('Yes')

Solution (Python):
S = input()
T = input()
s, t = [], []
for alp in "abcdefghijklmnopqrstuvwxyz":
  s.append(S.count(alp))
  t.append(T.count(alp))
s.sort()
t.sort()
if s == t:
  print("Yes")
else:
  print("No")

Solution (Python):

S = list(input())
T = list(input())
alpha = [chr(i) for i in range(97, 97+26)]
Sl = [0 for _ in range(26)]
Tl = [0 for _ in range(26)]
for i in range(len(alpha)):
    tmp = alpha[i]
    Sl[i] = S.count(tmp)
    Tl[i] = T.count(tmp)
Sl.sort()
Tl.sort()
print("Yes" if Sl==Tl else "No")

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

subs = {}
for s,t in zip(S,T):
    c = subs.get(s,t)
    if c == t:
        subs[s] = t
    else:
        print("No")
        break
else:
    if len(subs.values())-len(set(subs.values())) == 0:
        print("Yes")
    else:
        print("No")

Solution (Python):
S = input()
T = input()
alp = [chr(ord('a') + i) for i in range(26)]
kanri = [0]*26
flag = True
for i in range(len(S)):
  x = S[i]
  f = ord(x)-97
  if kanri[f] == 0:
    kanri[f] = T[i]
  else:
    if kanri[f] != T[i]:
      flag = False
      break
if flag:
  P = []
  for i in range(26):
    if kanri[i] != 0:
      P.append(kanri[i])
  Q = list(set(P))
  if len(Q) == len(P):
    print('Yes')
  else:
    print('No')
else:
  print('No')

Solution (Python):
A = list(input())
B = list(input())
dicB = {}
dicA = {}
for i in range(len(A)):
    dicB.setdefault(B[i],A[i])
    dicA.setdefault(A[i],B[i])
    
    
    if dicB.get(B[i]) != A[i] or dicA.get(A[i]) != B[i]:
        print("No")
        exit()
print("Yes")

Solution (Python):
from collections import*;i=lambda:sorted(Counter(input()).values());print('YNeos'[i()!=i()::2])

Solution (Python):
from collections import*
s=enumerate(input())
t=enumerate(input())
d1=defaultdict(list)
d2=defaultdict(list)
for k,v in s:
    d1[v].append(k)
for k,v in t:
    d2[v].append(k)
print(["No","Yes"][set(tuple(i)for i in d1.values())==set(tuple(i)for i in d2.values())])

Solution (Python):
def solve():
  query = 'abcdefghijklmnopqrstuvwxyz'
  squery = [0]*26
  tquery = [0]*26
  s = input()
  t = input()
  for i in range(26):
    tp = query[i]
    squery[i] = s.count(tp)
    tquery[i] = t.count(tp)
  squery.sort()
  tquery.sort()
  
  if squery == tquery : return 'Yes'
  else: return 'No'
    
  
print(solve())

Solution (Python):
S = input()
T = input()
li_S = [-1]*26
li_T = [-1]*26


for i in range(len(S)):
    li_S[ord(S[i])-97]=i if li_S[ord(S[i])-97]==-1 else li_S[ord(S[i])-97]
    li_T[ord(T[i])-97]=i if li_T[ord(T[i])-97]==-1 else li_T[ord(T[i])-97]


flag = True
for i in range(len(S)):
    if(li_S[ord(S[i])-97]!=li_T[ord(T[i])-97]):
        flag = False

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

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

dict1, dict2 = {}, {}

for i in list(S):
    dict1[i] = dict1.get(i, 0) + 1

for i in list(T):
    dict2[i] = dict2.get(i, 0) + 1


if sorted(dict1.values()) == sorted(dict2.values()) :
    print("Yes")
else :
    print("No")

Solution (Python):
from collections import Counter

S = Counter(input())
T = Counter(input())
s = sorted([v for v in S.values()])
t = sorted([v for v in T.values()])
if s == t:
    print("Yes")
else:
    print("No")

Solution (Python):
""" AtCoder """
import collections

S = input()
T = input()

s = {}
t = {}

for i in range(len(S)):
    if S[i] in s and s[S[i]] != T[i] or T[i] in t and t[T[i]] != S[i]:
        print("No")
        exit()
    s[S[i]] = T[i]
    t[T[i]] = S[i]

print("Yes")

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

def create_alphabet_array(s):
  alphabets = []
  list = [-1] * len(s)
  for i, item in enumerate(s):
    if not item in alphabets:
      alphabets.append(item)
    list[i] = alphabets.index(item)
  return list
  
slist = create_alphabet_array(s)
tlist = create_alphabet_array(t)

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

Solution (Python):
S, T = [input() for _ in range(2)]
smemo, tmemo = {}, {}
for si, ti in zip(S, T):
    if si in smemo and smemo[si] != ti or ti in tmemo and tmemo[ti] != si:
        print("No")
        quit()
    smemo[si], tmemo[ti] = ti, si
print("Yes")

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

sts = [set([]) for _ in range(26)]
rsts = [set([]) for _ in range(26)]

for i in range(len(S)):
    a = ord(S[i])-ord('a')
    b = ord(T[i])-ord('a')
    sts[a].add(b)
    rsts[b].add(a)

res=True
for st in sts:
    if res and len(st)>1:
        print('No')
        res=False
for st in rsts:
    if res and len(st)>1:
        print('No')
        res=False
if res:
    print('Yes')

Solution (Python):
from collections import Counter

S = input().strip()
T = input().strip()

if list(map(lambda x: x[1],Counter(S).most_common())) != list(map(lambda x: x[1],Counter(T).most_common())):
    print("No")
else:
    print("Yes")

Solution (Python):

from collections import defaultdict
from collections import deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
def LI(): return list(map(int, sys.stdin.readline().split()))
def I(): return int(sys.stdin.readline())
def LS():return list(map(list, sys.stdin.readline().split()))
def S(): return list(sys.stdin.readline())[:-1]
def IR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = I()
    return l
def LIR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = LI()
    return l
def SR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = S()
    return l
def LSR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = SR()
    return l
mod = 1000000007
sys.setrecursionlimit(1000000)


def A():
    return


def B():
    return


def C():
    s = S()
    t = S()
    n = len(s)
    d = defaultdict(list)
    for i in range(n):
        d[s[i]].append(t[i])
    d2 = defaultdict(list)
    for i in range(n):
        d2[t[i]].append(s[i])
    for i in d.keys():
        k = d[i]
        k = list(set(d[i]))
        if len(k) > 1:
            print("No")
            quit()
    for i in d2.keys():
        k = d2[i]
        k = list(set(d2[i]))
        if len(k) > 1:
            print("No")
            quit()
    print("Yes")

def D():
    return


def E():
    return


def F():
    return


def G():
    return


def H():
    return


if __name__ == "__main__":
    C()

Solution (Python):
s = input()
t = input()
sUsed = ""
tUsed = ""
buf = []
flag = 0
while len(s) > 0 and len(t) > 0:
    s0 = s[0]
    t0 = t[0]
    sUsed += s0
    buf = [i for i,x in enumerate(s) if x == s0]
    s = s.replace(s0,"")
    if t0 in tUsed and len(tUsed) > 0:
        flag = 1
    if not buf == [i for i,x in enumerate(t) if x == t0]:
        flag = 1
    tUsed += t0
    t = t.replace(t0,"")
    buf.clear()
    if flag == 1:
        break
if flag == 0:
    print("Yes")
else:
    print("No")

Solution (Python):

import sys

YES = "Yes"  
NO = "No"  

baseb = list("abcdefghijklmnopqrstuvwxyz")

N = 0


def solve(S: str, T: str):
    from collections import Counter

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

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



def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    S = next(tokens)  
    T = next(tokens)  
    solve(S, T)


if __name__ == '__main__':
    main()

Solution (Python):
def c():
    S = input()
    T = input()
    start = [-1] * 26
    goal = [-1] * 26
    for i in range(len(S)):
        a = ord(S[i]) - ord("a")
        b = ord(T[i]) - ord("a")

        if not start[a] == -1 or not goal[b] == -1:
            if not start[a] == b or not goal[b] == a:
                print("No")
                return 0
        else:
            start[a] = b
            goal[b] = a

    print("Yes")


c()

Solution (Python):
s = list(str(input()))
t = list(str(input()))
s_dict = {}
count = 0
for s_ in s:
    if s_ not in s_dict.keys():
        s_dict[s_] = count
        count += 1
t_dict = {}
count = 0
for t_ in t:
    if t_ not in t_dict.keys():
        t_dict[t_] = count
        count += 1
s = [s_dict[i] for i in s]
t = [t_dict[i] for i in t]
if s == t:
    print("Yes")
else:
    print("No")

Solution (Python):
S=input()
T=input()
R=[-1]*26
R2=[-1]*26
flag=1

for i in range(len(S)):
    a=ord(S[i])-97
    b=ord(T[i])-97
    if R[a]!=-1 or R2[b]!=-1:
        if R[a]!=b or R2[b]!=a:
            flag=0
            break
    else:
        R[a]=b
        R2[b]=a
if flag==0:
    print('No')
else:
    print('Yes')

Solution (Python):
s=input()
t=input()
ds={}
dt={}

q=0
for i in range(len(s)):
    
    if s[i] in ds.keys():
        if ds[s[i]]!=t[i]:
            q=1
            print("No")
            break
    else:
        
        
        
        
        
        ds[s[i]]=t[i]
    if t[i] in dt.keys():
        if dt[t[i]]!=s[i]:
            q=1
            print("No")
            break
    else:
        dt[t[i]]=s[i]

if q==0:
    print("Yes")

Solution (Python):
import collections
S = [i for i in input()]
T = [i for i in input()]
Scount = collections.Counter(S)
Tcount = collections.Counter(T)
check = True
for (s,t) in zip(Scount.most_common(),Tcount.most_common()):
    if s[1]!=t[1]:
        check = False
        break
if check == True:
    print("Yes")
else:
    print("No")

Solution (Python):
def solve(S, T):
    StoT = {}
    TtoS = {}
    for s, t in zip(S, T):
        if s not in StoT:
            StoT[s] = t
        if t not in TtoS:
            TtoS[t] = s
        
        if StoT[s] != t or TtoS[t] != s:
            return False

    return True
        


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

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

Solution (Python):



import sys

S = [x for x in input()]
T = [x for x in input()]

chars = dict([(c, i) for i, c in enumerate('abcdefghijklmnopqrstuvwxyz')])

match_chars = [[] for _ in range(26)]
for s, t in zip(S, T):
    match_chars[chars[s]].append(t)

for match_char in match_chars:
    if len(set(match_char)) > 1:
        print('No')
        sys.exit()
        
match_chars = [[] for _ in range(26)]
for s, t in zip(S, T):
    match_chars[chars[t]].append(s)

for match_char in match_chars:
    if len(set(match_char)) > 1:
        print('No')
        sys.exit()

print('Yes')

Solution (Python):
S = str(input())
T = str(input())
S_dict = {}
T_dict = {}
S_dict[S[0]] = 1
T_dict[T[0]] = 1
for i in range(1, len(S)):
    s, t = S[i], T[i]
    if s in S_dict.keys():
        if t in T_dict.keys():
            if S_dict[s] == T_dict[t]:
                S_dict[s] += 1
                T_dict[t] += 1
            else:
                print('No')
                quit()
        else:
            print('No')
            quit()
    else:
        if t in T_dict.keys():
            print('No')
            quit()
        else:
            S_dict[s] = 1
            T_dict[t] = 1

if len(S_dict) == len(T_dict):
    print('Yes')
else:
    print('No')

Solution (Python):


import sys


def solve(s, t):
  tr_s = {} 
  tr_t = {} 
  for i in range(len(s)):
    if t[i] not in tr_t:
      tr_t[t[i]] = s[i]
    if s[i] not in tr_s:
      tr_s[s[i]] = t[i]

    if (tr_s[s[i]] != t[i]) or (tr_t[t[i]] != s[i]):
      return False

  return True


S = str(input())
T = str(input())
if solve(S, T):
  print("Yes")
else:
  print("No")

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

s_to_t = {}
t_to_s = {}
enable = True
for i in range(len(s)):
    char_s = s[i]
    char_t = t[i]
    if char_s in s_to_t and char_t != s_to_t[char_s]:
        enable = False
        break
    if char_t in t_to_s and char_s != t_to_s[char_t]:
        enable = False
        break
    s_to_t[char_s] = char_t
    t_to_s[char_t] = char_s

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

Solution (Python):
S=input()
T=input()
fr=[s for s in S] 
to=[t for t in T]
N=len(fr)
h1=[];h2=[]
error=False
for i in range(N):
    if fr[i]==to[i]:
        if (fr[i] not in h1) and (to[i] not in h2):
            h1.append(fr[i]);h2.append(to[i])
        elif ((fr[i] in h1) and (to[i] not in h2)) or ((fr[i] not in h1) and (to[i] in h2)):
            error=True
            break;
        else:
            if h1.index(fr[i])==h2.index(to[i]):
                pass
            else:
                error=True
                break;
    else:
        if (fr[i] not in h1) and (to[i] not in h2):
            h1.append(fr[i]);h2.append(to[i])
        elif ((fr[i] in h1) and (to[i] not in h2)) or ((fr[i] not in h1) and (to[i] in h2)):
            error=True
            break;
        else:
            if h1.index(fr[i])==h2.index(to[i]):
                pass
            else:
                error=True
                break;
if error:
    print("No")
else:
    print("Yes")

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

def judge(S,T):
    start = [-1 for i in range(26) ] 
    goal = [-1 for i in range(26)]
    for i in range(len(S)):
        a = ord(S[i]) - ord('a')
        b = ord(T[i]) - ord('a')
        if start[a] != -1 or goal[b] != -1:
            if start[a]!= b or goal[b] !=a:
                print("No")
                break
        else:
            start[a] = b
            goal[b] =a
        if i==len(S)-1:
            print("Yes")
            
judge(s,t)

Solution (Python):
S = str(input())
T = str(input())
char = []
flag = True
for i in range(len(S)):
    if S[i] != T[i]:
        if (S[i] not in char) and (T[i] not in char):
            table = str.maketrans({S[i]:T[i], T[i]:S[i]})
            S = S.translate(table)
            char.append(T[i])
        else:
            flag = False
            break
    else:
        char.append(T[i])

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

Solution (Python):
from collections import Counter
S=input()
T=input()
s=list(S)
t=list(T)
a=Counter(s)
b=Counter(t)
c=a.most_common()
d=b.most_common()
flag=True
for i in range(min(len(d),len(c))):
    if d[i][1]==1 and c[i][1]==1:
        break
    if d[i][1]>=2 and flag:
        e=[]
        for j in range(len(s)):
            if t[j]==d[i][0]:
                e.append(s[j])
        for j in range(len(e)-1):
            if e[j]!=e[j+1]:
                flag=False
                break
    if c[i][1]>=2 and flag:
        f=[]
        for j in range(len(s)):
            if s[j]==c[i][0]:
                f.append(t[j])
        for j in range(len(f)-1):
            if f[j]!=f[j+1]:
                flag=False
                break
if flag:
    print('Yes')
else:
    print('No')

Solution (Python):
S = input()
T = input()
s = [0]*26
t = [0]*26

dict = {'a':0, 'b':1, 'c':2, 'd':3, 'e':4, 'f':5, 'g':6, 'h':7,
        'i':8, 'j':9, 'k':10, 'l':11, 'm':12, 'n':13, 'o':14,
        'p':15, 'q':16, 'r':17, 's':18, 't':19, 'u':20, 'v':21,
        'w':22, 'x':23, 'y':24, 'z':25}

for i in range(len(S)):
    s[dict[S[i]]] += 1
    t[dict[T[i]]] += 1
s.sort()
t.sort()
print('YNeos'[s!=t::2])

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

def f(S):
    idx = []
    dic = []
    for s in S:
        if s in dic:
            idx.append(dic.index(s))
        else:
            idx.append(len(dic))
            dic.append(s)
    
    return idx

s_idx = f(S)
t_idx = f(T)
for i in range(len(S)):
    if s_idx[i] != t_idx[i]:
        print("No")
        exit()

print("Yes")

Solution (Python):
from collections import Counter
import numpy as np

S=list(str(input()))
T=list(str(input()))
S_num=dict(Counter(S)).values()
T_num=dict(Counter(T)).values()
S_s=np.array([s for s in S_num])
T_s=np.array([s for s in T_num])

flag=False

if len(S_s)==len(T_s):
    if all(np.sort(S_s)==np.sort(T_s)):
        flag=True
if flag:
    print("Yes")
else:
    print("No")

Solution (Python):
from collections import*;C=Counter;i=lambda:C(C(input()).values());print('YNeos'[i()!=i()::2])

Solution (Python):
S = list(str(input()))
T = list(str(input()))
check = 1
bij1 = {}
bij2 = {}
for i in range(len(S)):
  if S[i] in bij1 and bij1[S[i]] != T[i]:
    check = 0
    break
  elif T[i] in bij2 and bij2[T[i]] != S[i]:
    check = 0
    break
  elif S[i] not in bij1 and T[i] not in bij2:
    bij1[S[i]] = T[i]
    bij2[T[i]] = S[i]
    
if check:
  print("Yes")
else:
  print("No")

Solution (Python):
S = input()
T = input()
s = []
t = []
for alp in "abcdefghijklmnopqrstuvwxyz":
  s.append(S.count(alp))
  t.append(T.count(alp))
if(sorted(s) == sorted(t)):
  print("Yes")
else:
  print("No")

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

import numpy as np
S_num = dict(Counter(S)).values()
T_num = dict(Counter(T)).values()
Ss = np.array([s for s in S_num])
Ts = np.array([s for s in T_num])

if len(Ss) != len(Ts):
    print("No")
else:
    if all(np.sort(Ss)==np.sort(Ts)):
        print("Yes")
    else:
        print("No")

Solution (Python):
import collections as c
s=input()
t=input()
d=c.defaultdict(list)
d2=c.defaultdict(list)
for k,v in enumerate(s):
    d[v].append(k)
for k,v in enumerate(t):
    d2[v].append(k)
a=set(tuple(i) for i in d.values())
b=set(tuple(i) for i in d2.values())
if a==b:
    print("Yes")
else:
    print("No")

Solution (Python):
from collections import Counter

s, t = input(), input()
c1 = sorted(Counter(s).values())
c2 = sorted(Counter(t).values())
print('Yes') if c1 == c2 else print('No')

Solution (Python):
from sys import stdin
from collections import Counter

input = stdin.readline

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


def main():
    C1 = sorted(Counter(S).values())
    C2 = sorted(Counter(T).values())

    print("Yes" if C1 == C2 else "No")
    return


main()

Solution (Python):
from sys import stdin
from collections import Counter

input = stdin.readline

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


def main():
    C1 = Counter(S).most_common()
    C2 = Counter(T).most_common()

    if len(C1) != len(C2):
        print("No")
        return

    flg = True
    for i in range(len(C1)):
        if C1[i][1] != C2[i][1]:
            flg = False

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


main()

Solution (Python):

from collections import Counter
from operator import itemgetter



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


def main():
    C1 = Counter(S).most_common()
    C2 = Counter(T).most_common()

    if len(C1) != len(C2):
        print("No")
        return

    flg = True
    for i in range(len(C1)):
        if C1[i][1] != C2[i][1]:
            flg = False

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


main()

Solution (Python):
input = open(0).read
S, T = input().split()


def main():
    C1 = [None] * (ord('z') - ord('a') + 1)
    C2 = [None] * (ord('z') - ord('a') + 1)

    flg = True

    for i in range(len(S)):
        c1 = ord(S[i]) - ord('a')
        c2 = ord(T[i]) - ord('a')

        if C1[c1] or C2[c2]:
            if c1 != C2[c2] or c2 != C1[c1]:
                flg = False
                break

        C1[c1] = c2
        C2[c2] = c1

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


main()

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

d1 = dict()
d2 = dict()
L = len(S)
for i in range(L):
    s = S[i]
    t = T[i]
    if s in d1 and d1[s] != t:
        print("No")
        exit()
    else:
        d1[s] = t
    if t in d2 and d2[t] != s:
        print("No")
        exit()
    else:
        d2[t] = s
print("Yes")

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

ans = 'Yes'

d = dict([])
for i,s in enumerate(S):
    t = T[i]
    try:
        if d[s] != t:
            ans = 'No'
            break
    except:
        d[s] = t

d = dict([])
for i,t in enumerate(T):
    if ans == 'No':
        break
    s = S[i]
    try:
        if d[t] != s:
            ans = 'No'
            break
    except:
        d[t] = s
        
print(ans)

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

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

s_dict, t_dict = {}, {}

for i in range(len(S)):
    if S[i] in s_dict.keys():
        if s_dict[S[i]] != T[i]:
            print("No")
            exit()
    else:
        s_dict[S[i]] = T[i]

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

print("Yes")

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


from collections import Counter


s_dict, t_dict = {}, {}

for i in range(len(S)):
    if S[i] in s_dict.keys():
        if s_dict[S[i]] != T[i]:
            print("No")
            exit()
    else:
        s_dict[S[i]] = T[i]

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

print("Yes")

Solution (Python):
def ans():
  S = input()
  T = input()
  s = []
  t = []
  for alp in "abcdefghijklmnopqrstuvwxyz":
    s.append(S.count(alp))
    t.append(T.count(alp))
  if(sorted(s) == sorted(t)):
    print("Yes")
  else:
    print("No")
ans()

Solution (Python):
ri = lambda: int(input())
rl = lambda: list(map(int,input().split()))
rr = lambda N: [ri() for _ in range(N)]
YN = lambda b: print('YES') if b else print('NO')
yn = lambda b: print('Yes') if b else print('No')
OE = lambda x: print('Odd') if x%2 else print('Even')
INF = 10**18

S=input()
T=input()

def n2l(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

yn(n2l(S)==n2l(T))

Solution (Python):
ri = lambda: int(input())
rl = lambda: list(map(int,input().split()))
rr = lambda N: [ri() for _ in range(N)]
YN = lambda b: print('YES') if b else print('NO')
yn = lambda b: print('Yes') if b else print('No')
OE = lambda x: print('Odd') if x%2 else print('Even')
INF = 10**18

S=input()
T=input()

dT = dict()
dS = dict()

for i,t in enumerate(T):
    if t not in dT:
        dT[t] = [i]
    else:
        dT[t].append(i)
for i,s in enumerate(S):
    if s not in dS:
        dS[s] = [i]
    else:
        dS[s].append(i)

def ans():
    for c in map(chr,range(ord('a'),ord('z')+1)):
        if c in dT:
            res = S[dT[c][0]]
            for i in dT[c]:
                if res != S[i]:
                    return 0
    for c in map(chr,range(ord('a'),ord('z')+1)):
        if c in dS:
            res = T[dS[c][0]]
            for i in dS[c]:
                if res != T[i]:
                    return 0
    return 1

yn(ans())

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

S = input()
T = input()
start = [-1] * 26
goal = [-1] * 26

for i in range(len(S)):
    start_index = ord(S[i]) - ord("a")
    goal_index = ord(T[i]) - ord("a")
    if start[start_index] != -1 or goal[goal_index] != -1:
        if start[start_index] != goal_index or goal[goal_index] != start_index:
            print("No")
            exit()
        else:
            continue
    start[start_index] = goal_index
    goal[goal_index] = start_index
print("Yes")
exit()
print(start, "\n", goal)


def transform_char(s):
    return chr(s+ord("a"))


print(list(map(transform_char, start)))

Solution (Python):
def string_transformation(S: int, T: int) -> bool:
    ds = {}
    dt = {}
    for s, t in zip(S, T):
        if s in ds:
            if ds[s] != t:
                return False
        else:
            ds[s] = t

        if t in dt:
            if dt[t] != s:
                return False
        else:
            dt[t] = s

    return True


if __name__ == "__main__":
    S = input()
    T = input()
    ans = string_transformation(S, T)
    print('Yes' if ans else 'No')

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

start = [-1]*26
goal = [-1]*26
for i in range(len(s)):
	a = ord(s[i]) - ord('a')
	b = ord(t[i]) - ord('a')
	if start[a] != -1 or goal[b] != -1:
		if start[a] != b or goal[b] != a:
			print('No')
			exit()
	start[a] = b
	goal[b] = a
print('Yes')

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


def f(s):
    l=[]
    a="abcdefghijklmnopqrstuvwxyz"
    r=""
    for i in range(len(s)):
        if s[i] in l:
            for j in range(len(l)):
                if s[i]==l[j]:
                    r+=a[j]
        else:
            r+=a[len(l)]
            l.append(s[i])
    return r

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

Solution (Python):


S, T = input(), input()
nS = len(S)

dS, dT = {}, {}
for i in range(nS):
    if not S[i] in dS:
        dS[S[i]] = T[i]
    elif not dS[S[i]] == T[i]:
        print("No")
        exit()

    if not T[i] in dT:
        dT[T[i]] = S[i]
    elif not dT[T[i]] == S[i]:
        print("No")
        exit()

print("Yes")

Solution (Python):
S = input()
T = input()
d_st = {}
d_ts = {}
flag = True
for i in range(len(S)):
    if S[i] not in d_st:
        d_st[S[i]] = T[i]
    else:
        if d_st[S[i]] != T[i]:
            flag = False
            break
    if T[i] not in d_ts:
        d_ts[T[i]] = S[i]
    else:
        if d_ts[T[i]] != S[i]:
            flag = False
            break
    
if flag:
    print("Yes")
else:
    print("No")

Solution (Python):
import collections
S = input()
T = input()
s_alp = [chr(i) for i in range(97, 97+26)]
s_ = ['']*26
t_alp = [chr(i) for i in range(97, 97+26)]
t_ = ['']*26
for i in range(len(S)):
  if s_[s_alp.index(S[i])] == '':
    s_[s_alp.index(S[i])] = T[i]
  else:
    if s_[s_alp.index(S[i])] != T[i]:
      print('No')
      break
  if t_[t_alp.index(T[i])] == '':
    t_[t_alp.index(T[i])] = S[i]
  else:
    if t_[t_alp.index(T[i])] != S[i]:
      print('No')
      break
else:
  print('Yes')

Solution (Python):




S = input()
T = input()
alpS = [-1 for i in range(26)] 
alpT = [-1 for i in range(26)]
lenS = len(S)
flg = 1

for i in range(lenS):
    alp = ord(S[i]) - 97
    if alpS[alp] == -1:
        alpS[alp] = ord(T[i]) - 97
    else:
        if alpS[alp] != ord(T[i]) - 97:
            flg = 0
            break

for i in range(lenS):
    alp = ord(T[i]) - 97
    if alpT[alp] == -1:
        alpT[alp] = ord(S[i]) - 97
    else:
        if alpT[alp] != ord(S[i]) - 97:
            flg = 0
            break

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

Solution (Python):
s=[0 for _ in range(26)]
t=[0 for _ in range(26)]
S=input()
T=input()

for i in range(len(S)):
    s[ord(S[i])-ord('a')]+=1
    t[ord(T[i])-ord('a')]+=1

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

Solution (Python):
from collections import defaultdict
S=input()
T=input()
d=defaultdict(list)
e=defaultdict(list)
for i in range(len(S)):
  d[S[i]].append(i)
  e[T[i]].append(i)
print("Yes" if all(item in e.values() for item in d.values()) else "No")

Solution (Python):
S = input()
T = input()
trans_dict = dict()
trans_dict_ = dict()
flg = 0
for s, t in zip(S, T):
    if trans_dict.get(s) is None:
        trans_dict[s] = t
    elif trans_dict.get(s) == t:
        continue
    else:
        flg = 1
        break
    if trans_dict_.get(t) is None:
        trans_dict_[t] = s
    elif trans_dict.get(t) == s:
        continue
    else:
        flg = 1
        break
if flg == 1:
    print("No")
else:
    print("Yes")

Solution (Python):
S = input()
T = input()
def count(string):
    Ans =[0]*len(string)
    Alpha = [0]*26
    c = 0
    for st in string:
        if(Alpha[ord(st)-97] == 0):
            Alpha[ord(st)-97] = c
            Ans[c] = c
        elif(Alpha[ord(st)-97] != 0):
            Ans[c] = Alpha[ord(st)-97]
    
        c += 1
    return Ans

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

Solution (Python):
from collections import Counter
s=Counter(input())
t=Counter(input())
S=sorted(s.values())
T=sorted(t.values())
print("Yes" if S==T else "No")

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=Counter(input())
T=Counter(input())
s=S.values()
t=T.values()
print("Yes" if sorted(s)==sorted(t) else "No")

Solution (Python):
S,T=input(),input()
N=len(S)
link_a={}
link_b={}

for i in range(N):
    if  T[i] in link_a:
        if link_a[T[i]] == S[i]:
            continue
        else:
            print('No')
            exit()
    else:
        link_a[T[i]]=S[i]

for i in range(N):
    if  S[i] in link_b:
        if link_b[S[i]] == T[i]:
            continue
        else:
            print('No')
            exit()
    else:
        link_b[S[i]]=T[i]
print('Yes')

Solution (Python):
S = input()
T = input()
S_list = [i for i in S]
T_list = [i for i in T]
S_set = set(S_list)
T_set = set(T_list)
def judge():
  if len(S_set)==len(T_set)==len(S_list):
    return "Yes"
  for car in S_set:
    if [j for j, x in enumerate(T_list) if x == T_list[S_list.index(car)]]!=[j for j, x in enumerate(S_list) if x == car]:
      return "No"
  return "Yes"

print(judge())

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

import re
def findall(string,s):
    return [m.start() for m in re.finditer(s, string)]

from collections import Counter
C1 = Counter(T).most_common()
C2 = Counter(S).most_common()

ans = 'Yes'

for c in C1:
    if c[1] >= 2:
        
        ls = findall(T,c[0])
        s_set = set()
        for num in ls:
            s_set.add(S[num])
        if len(s_set) > 1:
            ans = 'No'
            
for c in C2:
    if c[1] >= 2:
        
        ls = findall(S,c[0])
        s_set = set()
        for num in ls:
            s_set.add(T[num])
        if len(s_set) > 1:
            ans = 'No'
            
print(ans)

Solution (Python):
s=[0 for _ in range(26)]
t=[0 for _ in range(26)]
S=input()
T=input()

for i in range(len(S)):
  s[ord(S[i])-ord('a')]+=1
  t[ord(T[i])-ord('a')]+=1

s.sort()
t.sort()
print('Yes' if s==t else 'No')

Solution (Python):
def check(s,t):
    if len(s) != len(t):
        return False
    l = len(s)
    s_t = {}
    t_s = {}
    for i in range(l):
        if s[i] in s_t.keys():
            if s_t[s[i]] != t[i]:
                return False
        else:
            s_t[s[i]] = t[i]
        if t[i] in t_s.keys():
            if t_s[t[i]] != s[i]:
                return False
        else:
            t_s[t[i]] = s[i]
    return True

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