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):
from collections import Counter
s=Counter(list(input()))
t=Counter(list(input()))
s,t=list(s.values()),list(t.values())
print("Yes" if sorted(s)==sorted(t) else "No")

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

Solution (Python):
from collections import Counter


S = Counter(input())
T = Counter(input())
if sorted(S.values()) == sorted(T.values()):
    print("Yes")
else:
    print("No")

Solution (Python):
import sys

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


start=[-1]*26
end=[-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 end[b]!=-1):
        if(start[a]!=b or end[b]!=a):
            print("No")
            sys.exit()
    start[a]=b
    end[b]=a
print("Yes")

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

s_d = {}
t_d = {}
for i in range(len(s)):
    if s[i] not in s_d:
        new_num = len(s_d)+1
        s_d[s[i]] = new_num
        s_valid = -1
    else:
        s_valid = s_d[s[i]]

    if t[i] not in t_d:
        new_num = len(t_d)+1
        t_d[t[i]] = new_num
        t_valid = -1
    else:
        t_valid = t_d[t[i]]

    if s_valid != t_valid:
        print('No')
        break

else:
    print('Yes')

Solution (Python):
s=list(input())
t=list(input())
match=[]
accord=[]
for i in range(len(s)):
    if s[i] in match:
        ind=match.index(s[i])
        acc=accord[ind]
        if t[i]!=acc:
            print('No')
            exit()
    elif t[i] in accord:
        ind=accord.index(t[i])
        mat=match[ind]
        if s[i]!=mat:
            print('No')
            exit()
    else:
        match.append(s[i])
        accord.append(t[i])
print('Yes')

Solution (Python):
table = {alphabet: "-" for alphabet in "abcedfghijklmnopqrstuvwxyz"}
rev_table = {alphabet: "-" for alphabet in "abcedfghijklmnopqrstuvwxyz"}

s = str(input())
t = str(input())

flag = True

for i in range(len(s)):
    if table[s[i]] == t[i]:
        continue
    elif table[s[i]] == "-":
        table[s[i]] = t[i]
    else:
        flag = False
        break

for i in range(len(t)):
    if rev_table[t[i]] == s[i]:
        continue
    elif rev_table[t[i]] == "-":
        rev_table[t[i]] = s[i]
    else:
        flag = False
        break

if flag is True:
    print("Yes")
else:
    print("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):
def mi():
    return map(int, input().split())

def main():
    S = input()
    T = input()
    ds = {}
    dt = {}
    for i in range(len(S)):
        if not S[i] in ds:
            ds[S[i]] = 0
        if not T[i] in dt:
            dt[T[i]] = 0

        ds[S[i]] += 1
        dt[T[i]] += 1
    ls = sorted(list(ds.values()))
    lt = sorted(list(dt.values()))
    
    print('Yes' if ls == lt else 'No')


if __name__ == '__main__':
    main()

Solution (Python):
import sys

input = sys.stdin.readline


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

    S_table = {}
    T_table = {}
    ans = "Yes"
    for s, t in zip(S, T):
        
        if s in S_table:
            if S_table[s] != t:
                ans = "No"
        else:
            S_table[s] = t
        
        if t in T_table:
            if T_table[t] != s:
                ans = "No"
        else:
            T_table[t] = s

    print(ans)


if __name__ == "__main__":
    main()

Solution (Python):

def main():
    S = list(input())
    T = list(input())
    d1 = {}
    d2 = {}
    for k in set(T):
        d1[k] = set()
    for k in set(S):
        d2[k] = set()
    for s, t in zip(S, T):
        d1[t].add(s)
        d2[s].add(t)
    if all([len(v) == 1 for v in d1.values()]) and all([len(v) == 1 for v in d2.values()]):
        print('Yes')
    else:
        print('No')

if __name__ == '__main__':
    main()

Solution (Python):

s=list(input())
t=list(input())
l=len(s)

henkan1 = {chr(ord("a")+i) : set() for i in range(26) }
henkan2 = {chr(ord("a")+i) : set() for i in range(26) }

for i in range(l):

    henkan1[s[i]].add(t[i])
    henkan2[t[i]].add(s[i])
        
if all(len(h) <=1 for h in henkan1.values()) and all(len(h) <=1 for h in henkan2.values()):
    print("Yes")
else:
    print("No")

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

alphabet = [chr(i) for i in range(97, 97+26)]
dict_alphabet = {}
for i, alphabet in enumerate(alphabet):
    dict_alphabet[alphabet] = i

ans = 'Yes'

alphabet_s2t = [0] * 26
for i in range(n):
    if not alphabet_s2t[dict_alphabet[s[i]]]:
        alphabet_s2t[dict_alphabet[s[i]]] = t[i]
    else:
        if alphabet_s2t[dict_alphabet[s[i]]] != t[i]:
            ans = 'No'

alphabet_t2s = [0] * 26
for i in range(n):
    if not alphabet_t2s[dict_alphabet[t[i]]]:
        alphabet_t2s[dict_alphabet[t[i]]] = s[i]
    else:
        if alphabet_t2s[dict_alphabet[t[i]]] != s[i]:
            ans = 'No'
print(ans)

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

Rs = {}
Rt = {}

for s,t in zip(S,T):
    
    if s in Rs.keys() and Rs[s] != t:
        print("No")
        exit()
    if t in Rt.keys() and Rt[t] != s:
        print("No")
        exit()

    if not s in Rs.keys():
        Rs[s] = t
    if not t in Rt.keys():
        Rt[t] = s

ress = [""] * len(S)
for i,s in enumerate(S):
    ress[i] = Rs[s]

print("Yes" if "".join(ress)==T else "No")

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

Rs = {}
Rt = {}

for s,t in zip(S,T):
    
    if s in Rs.keys() and Rs[s] != t:
        print("No")
        exit()
    if t in Rt.keys() and Rt[t] != s:
        print("No")
        exit()

    if not s in Rs.keys():
        Rs[s] = t
    if not t in Rt.keys():
        Rt[t] = s

ress = [""] * len(S)
rest = [""] * len(S)
for i,s in enumerate(S):
    ress[i] = Rs[s]

for i,t in enumerate(T):
    rest[i] = Rt[t]
print("Yes" if "".join(ress)==T and "".join(rest)==S 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):
S = list(input())
T = list(input())
N = len(S)

abc = 'abcdefghijklmnopqrstuvwxyz'
sviewed = {c:False for c in abc}
spair = {}

tviewed = {c:False for c in abc}
tpair = {}

for i in range(N):
  si = S[i]
  ti = T[i]
  if sviewed[si] == True:
    if spair[si] != ti:
      print('No')
      exit()
  else:
    sviewed[si] = True
    spair[si] = ti
    
  if tviewed[ti] == True:
    if tpair[ti] != si:
      print('No')
      exit()
  else:
    tviewed[ti] = True
    tpair[ti] = si
    
print('Yes')

Solution (Python):
from collections import defaultdict
s = input()
t = input()
cnt_s = defaultdict(int)
cnt_t = defaultdict(int)
for i in range(len(s)):
    cnt_s[s[i]] += 1
    cnt_t[t[i]] += 1

cnt_s = sorted(cnt_s.values())
cnt_t = sorted(cnt_t.values())
if len(cnt_s) != len(cnt_t):
    ans = "No"
else:
    ans = "Yes"
    for i in range(len(cnt_s)):
        if cnt_s[i] != cnt_t[i]:
            ans = "No"
            break
print(ans)

Solution (Python):
import sys
import collections

s = list(map(str,input()))
t = list(map(str,input()))
cnts = collections.Counter(s)
cntt = collections.Counter(t)
cs = sorted(cnts.values())
ct = sorted(cntt.values())

if len(s) != len(t):
    print("No")
    sys.exit()

for i,j in zip(cs,ct):
    if i != j:
        print("No")
        sys.exit()

print("Yes")

Solution (Python):






from collections import defaultdict











import sys
sys.setrecursionlimit(10000000)
mod = 10**9 + 7

def readInts():
  return list(map(int,input().split()))
def I():
  return int(input())
dic_s = defaultdict(str)
dic_t = defaultdict(str)
s = input()
t = input()



for i in range(len(s)):
    if dic_s[s[i]] or dic_t[t[i]]:
        
        if dic_s[s[i]] == t[i] and dic_t[t[i]] == s[i]:
            pass
        else:
            print('No')
            exit()
    else:
        dic_s[s[i]] = t[i]
        dic_t[t[i]] = s[i]
print("Yes")

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

v1 = sorted(c_S.values())
v2 = sorted(c_T.values())
if len(v1) != len(v2):
    print('No')
    exit()
for s1, s2 in zip(v1, v2):
    if s1 != s2:
        print('No')
        exit()
print('Yes')

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

dic = {}
dic2 = {}

for i,j in zip(s,t):
    if j not in dic:
        if i in dic2:
            print("No")
            exit()
        dic[j] = i
        dic2[i] = j
    else:
        if dic[j] != i:
            print("No")
            exit()
print("Yes")

Solution (Python):
s = input()
s = list(s)
t = input()
t = list(t)
import string
alpha = string.ascii_lowercase
alpha = list(alpha)
dic_1 = {}
dic_2 = {}
for a in alpha:
  dic_1[a] = 0
  dic_2[a] = 0
s_result = []  
t_result = []
for _ in s:
  if dic_1[_] == 0:
    i = max(dic_1.values()) + 1
    dic_1[_] = i
    s_result.append(i)
  else:
    s_result.append(dic_1[_])
for _ in t:
  if dic_2[_] == 0:
    i = max(dic_2.values()) + 1
    dic_2[_] = i
    t_result.append(i)
  else:
    t_result.append(dic_2[_])    
check = True

for i in range(len(s_result)):
  if s_result[i] != t_result[i]:
    check = False  
if check == True:
  print("Yes")
else:
  print("No")

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

sts = set(S)
stt = set(T)

for i in range(26):
  c = chr(ord('a')+i)
  idx1 = [i for i, x in enumerate(T) if x == c]
  st1 = set([])
  idx2 = [i for i, x in enumerate(S) if x == c]
  st2 = set([])
  
  for j in idx1:
    if S[j] not in st1 and len(st1) > 0:
      print('No')
      exit()
    elif len(st1) == 0:
      st1.add(S[j])
  for j in idx2:
    if T[j] not in st2 and len(st2) > 0:
      print('No')
      exit()
    elif len(st2) == 0:
      st2.add(T[j])
      
print('Yes')

Solution (Python):
s,t=input(),input()
ss,ts=[set()for i in range(26)],[set()for i in range(26)]
sc={}
tc={}
for i in range(len(s)):
    if s[i]not in sc:
        if t[i] in tc:print("No");exit()
        else:
            d=len(sc)
            ss[d].add(i)
            ts[d].add(i)
            tc[t[i]]=d
            sc[s[i]]=d
    else:
        if t[i]not in tc or sc[s[i]]!=tc[t[i]]:print("No");exit()
        else:
            ss[sc[s[i]]].add(i)
            ts[sc[s[i]]].add(i)
for i in range(26):
    if ss[i]!=ts[i]:print("No");break
else:print("Yes")

Solution (Python):
s=input()
t=input()
letters=[]
count=[]
for i in range(len(s)):
  if s[i] in letters:
    count[letters.index(s[i])].append(i)
  else:
    count.append([i])
    letters.append(s[i])
failflag=0
for i in count:
  r=t[i[0]]
  for j in i:
    if t[j]!=r:
      failflag=1
letters=[]
count=[]
for i in range(len(s)):
  if t[i] in letters:
    count[letters.index(t[i])].append(i)
  else:
    count.append([i])
    letters.append(t[i])
for i in count:
  r=s[i[0]]
  for j in i:
    if s[j]!=r:
      failflag=1
if failflag==0:
  print('Yes')
else:
  print('No')

Solution (Python):
from collections import Counter
s = Counter(input())
t = Counter(input())
s_n = sorted([x for x in s.values()])
t_n = sorted([x for x in t.values()])
print("Yes" if s_n==t_n else "No")

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

Solution (Python):
from collections import Counter

S = input()
T = input()

s = sorted(list(Counter(S).values()))
t = sorted(list(Counter(T).values()))

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

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

f = True
for (s1, s2) in [(s, t), (t, s)]:
    d = dict()
    for c1, c2 in zip(s1, s2):
        if c1 not in d:
            d[c1] = c2
        elif d[c1] != c2:
            f = False
            break

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

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










ns = len(S)
indexS = {}
for i in range(ns):
    s = S[i]
    if s in indexS:
        indexS[s].append(i)
    else:
        indexS[s] = [i]
indexT = {}
for i in range(ns):
    t = T[i]
    if t in indexT:
        indexT[t].append(i)
    else:
        indexT[t] = [i]

for i in range(ns):
    s = S[i]
    t = T[i]
    i_s = len(indexS[s])
    i_t = len(indexT[t])
    if i_s != i_t:
        print("No")
        break
else:
    print("Yes")

Solution (Python):
import sys
input = sys.stdin.readline
from collections import defaultdict


def read():
    S = input().strip()
    T = input().strip()
    return S, T


def solve(S, T):
    N = len(S)
    u2t = dict()
    t2u = dict()
    for i in range(N):
        if S[i] not in u2t:
            u2t[S[i]] = T[i]
        elif u2t[S[i]] != T[i]:
            return "No"
        if T[i] not in t2u:
            t2u[T[i]] = S[i]
        elif t2u[T[i]] != S[i]:
            return "No"
    return "Yes"


if __name__ == '__main__':
    inputs = read()
    outputs = solve(*inputs)
    if outputs is not None:
        print("%s" % str(outputs))

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

for s, t in zip(S, T):
    if s in D:
        if D[s] != t:
            print('No')
            exit()
    elif t in D.values():
        print('No')
        exit()
    else:
        D[s] = t

print('Yes')

Solution (Python):





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

    memo1 = {}
    memo2 = {}
    for i in range(N):
        if S[i] not in memo1:
            memo1[S[i]] = T[i]
        else:
            if memo1[S[i]] != T[i]:
                return "No"
        if T[i] not in memo2:
            memo2[T[i]] = S[i]
        else:
            if memo2[T[i]] != S[i]:
                return "No"

    return "Yes"


print(main())

Solution (Python):
s = str(input())
t = str(input())
ds = {chr(i+97): -1 for i in range(26)}
dt = {chr(i+97): -1 for i in range(26)}
for i in range(len(s)):
    if ds[s[i]] >= 0:
        if ds[s[i]] != ord(t[i]):
            print('No')
            break
    if dt[t[i]] >= 0:
        if dt[t[i]] != ord(s[i]):
            print('No')
            break
    if ds[s[i]] < 0:
        ds[s[i]] = ord(t[i])
    if dt[t[i]] < 0:
        dt[t[i]] = ord(s[i])
else:
    print('Yes')

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

m = dict()

for a, b in zip(s, t):
    if a in m and b != m[a]:
        print('No')
        exit()

    m[a] = b

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

Solution (Python):
a = input()
b = input()
dic = {}

for i in range(len(a)):
  if not b[i] in dic:
    dic[b[i]] = a[i]
  else:
    if dic[b[i]] != a[i]:
      print("No")
      quit()
  
c = list(dic.values())
d = set(c)


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

Solution (Python):
s=input()
t=input()
n=len(s)
s=sorted(s)
t=sorted(t)
Lists={}
nums=[]
Listt={}
numt=[]

for i in range(n):
    Lists.setdefault(s[i], 0)
    Listt.setdefault(t[i], 0)
    Lists[s[i]]+=1
    Listt[t[i]]+=1
    
for j in Lists.values():
    nums.append(j)
    
for j in Listt.values():
    numt.append(j)





if (sorted(nums)==sorted(numt)):
    print("Yes")
else:
    print("No")

Solution (Python):
import sys
s = input()
t = input()
dic = {'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}
sl = [0]*26
tl = [0]*26
for i in s: sl[dic[i]] += 1
for i in t: tl[dic[i]] += 1
sl.sort()
tl.sort()
for i in range(26):
    if sl[i] != tl[i]:
        print("No")
        sys.exit()
print("Yes")

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):
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees, log2
from itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left, insort, insort_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10**9 + 7


S = input()
T = input()

S_dic = defaultdict(list)
T_dic = defaultdict(list)

for i in range(len(S)):
	S_dic[S[i]].append(i)
	T_dic[T[i]].append(i)

if sorted(S_dic.values()) == sorted(T_dic.values()):
	print("Yes")
else:
	print("No")

Solution (Python):


S = list(str(input()))
T = list(str(input()))
l = len(S)
d = set()

ans = 'Yes'
for i in range(l):
    if S[i] != T[i]:
        tmp = S[i]
        if S[i] in d or T[i] in d:
            ans = 'No'
            break
        d.add(T[i])
        for j in range(i, l):
            if S[j] == tmp:
                S[j] = T[i]
            elif S[j] == T[i]:
                S[j] = tmp
    else:
        d.add(T[i])

print(ans)

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


s = input()
t = input()

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

Solution (Python):
S=list(input())
T=list(input())
slist=[None]*26
flag=True
for i in range(len(S)):
    if slist[ord(S[i])-97] == None and T[i] not in slist:
        slist[ord(S[i])-97] = T[i]
    elif slist[ord(S[i])-97] != T[i]:
        flag = False
        break
    else:
        slist[ord(S[i])-97] = T[i]


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

Solution (Python):
S = input()
T = input()
N = len(S)
dictXY = {}
dictYX = {}
for i in range(N):
    X = S[i]
    Y = T[i]
    if X in list(dictXY.keys()):
        dictXY[X].append(Y)
    else:
        dictXY[X] = [Y]
    if Y in list(dictYX.keys()):
        dictYX[Y].append(X)
    else:
        dictYX[Y] = [X]

al=[chr(ord('a') + i) for i in range(26)]

flag = 0
for Z in al:
    if Z in list(dictXY.keys()):
        if len(set(dictXY[Z]))>1:
            flag = 1
    if Z in list(dictYX.keys()):
        if len(set(dictYX[Z]))>1:
            flag = 1
if flag==0:
    print("Yes")
else:
    print("No")

Solution (Python):
import sys
def input(): return sys.stdin.readline().strip()


def main():
    S = input()
    T = input()
    """
    置換が互換の積でかけることから、S->Tの変換がアルファベットの置換で表現できればよい。
    """
    d = {chr(i + 97): -1 for i in range(26)}
    d_inv = {chr(i + 97): -1 for i in range(26)}
    for i, s in enumerate(S):
        t = T[i]
        if d[s] != -1 or d_inv[t] != -1:
            if d[s] != t or d_inv[t] !=s:
                print("No")
                return
        d[s] = t
        d_inv[t] = s
    print("Yes")


if __name__ == "__main__":
    main()

Solution (Python):
def examA():
    A = LI()
    A.sort()
    ans = A[2]*10+A[1]+A[0]
    print(ans)
    return

def examB():
    N, M, x, y = LI()
    X = LI()
    Y = LI()
    X.sort(); Y.sort()
    if max(X[-1],x)<min(Y[0],y):
        print("No War")
    else:
        print("War")
    return

def examC():
    S = SI()
    T = SI()
    N = len(S)
    Ds = defaultdict(str)
    Dt = defaultdict(str)
    for i in range(N):
        s = S[i]; t = T[i]
        if Ds[s]!="" and Ds[s]!=t:
            print("No")
            return
        Ds[s] = t
        if Dt[t] != "" and Dt[t] != s:
            print("No")
            return
        Dt[t] = s
    print("Yes")
    return

def examD():
    ans = 0
    print(ans)
    return

import sys,bisect,itertools,heapq,math,random
from copy import deepcopy
from heapq import heappop,heappush,heapify
from collections import Counter,defaultdict,deque
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
def I(): return int(input())
def LI(): return list(map(int,sys.stdin.readline().split()))
def LSI(): return list(map(str,sys.stdin.readline().split()))
def LS(): return sys.stdin.readline().split()
def SI(): return sys.stdin.readline().strip()
global mod,mod2,inf,alphabet,_ep
mod = 10**9 + 7
mod2 = 998244353
inf = 10**18
_ep = 10**(-12)
alphabet = [chr(ord('a') + i) for i in range(26)]

sys.setrecursionlimit(10**7)

if __name__ == '__main__':
    examC()

"""
142
12 9 1445 0 1
asd dfg hj o o
aidn
"""

Solution (Python):
from collections import Counter

S = input()
T = input()

counter_s = Counter(S)
counter_t = Counter(T)


s_value = sorted(counter_s.values())
t_value = sorted(counter_t.values())


if s_value == t_value:
    print("Yes")
else:
    print("No")

Solution (Python):
s=list(input())
t=list(input())
S={}
T={}
for i in s:
    if i in S.keys():
        S[i]+=1
    else:
        S[i]=1
for i in t:
    if i in T.keys():
        T[i]+=1
    else:
        T[i]=1
Svalues=sorted(S.values())
Tvalues=sorted(T.values())
if Tvalues==Svalues:
    print('Yes')
else:
    print('No')

Solution (Python):
s,t=[sorted(t.count(i)for i in set(t))for t in open(0)]
print('YNeos'[s!=t::2])

Solution (Python):
s,t=map(lambda x:sorted(x.count(i)for i in set(x)),open(0))
print('YNeos'[s!=t::2])

Solution (Python):
from collections import Counter
s1 = sorted(list(dict(Counter(input())).values()))
t1 = sorted(list(dict(Counter(input())).values()))
print(['No', 'Yes'][s1 == t1])

Solution (Python):
from collections import Counter
S = Counter(list(input()))
T = Counter(list(input()))
if len(S) != len(T):
    print("No")
else:
    Sv = []
    Tv = []
    for v in S.values():
        Sv.append(v)
    for v in T.values():
        Tv.append(v)
    Svc = Counter(Sv)
    Tvc = Counter(Tv)
    if Svc == Tvc:
        print("Yes")
    else:
        print("No")

Solution (Python):
s = list(input())
t = list(input())
s_to_t = {chr(c):set() for c in range(ord('a'),ord('z')+1)}
t_to_s = {chr(c):set() for c in range(ord('a'),ord('z')+1)}

for i in range(len(s)):
    s_to_t[s[i]].add(t[i])
    t_to_s[t[i]].add(s[i])

for c in range(ord('a'), ord('z')+1):
    if len(s_to_t[chr(c)]) > 1 or len(t_to_s[chr(c)]) > 1:
        print('No')
        exit()
print('Yes')

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

Solution (Python):
S=input()
T=input()
s=dict()
for i in range(len(S)):
    a=S[i]
    if a in s:
        s[a]+=1
    else:
        s[a]=1

t=dict()
for i in range(len(T)):
    a=T[i]
    if a in t:
        t[a]+=1
    else:
        t[a]=1

l=[]
r=[]
for idx in s:
    a=s[idx]
    l.append(a)
for idx in t:
    a=t[idx]
    r.append(a)

l.sort()
r.sort()
if len(l)!=len(r):
    print("No")
    exit()
for i in range(len(l)):
    if l[i]==r[i]:
        pass
    else:
        print("No")
        exit()

print("Yes")

Solution (Python):
from collections import Counter


S = list(input())
S = "".join(sorted(S))
T = list(input())
T = "".join(sorted(T))


counter_s = Counter(S).most_common()
counter_t = Counter(T).most_common()

if len(counter_t) != len(counter_s):
    print("No")
elif S == T:
    print("Yes")
else:
    c_match = [True] * len(counter_t)
    for i in range(len(counter_t)):
        co_s = counter_s[i][1]
        co_t = counter_t[i][1]

        if co_s != co_t:
            c_match[i] = False

    if c_match.count(False) == 0:
        print("Yes")
    else:
        print("No")

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

sd={}
td={}
cond=True
for i in range(len(S)):
    if S[i] not in sd:
        sd[S[i]]=T[i]
    else:
        if sd[S[i]]!=T[i]:
            cond=False
            break
    if T[i] not in td:
        td[T[i]]=S[i]
    else:
        if td[T[i]]!=S[i]:
            cond=False
            break

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

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




sd={}
td={}
cond=True
for i in range(len(S)):
    if S[i] not in sd:
        sd[S[i]]=T[i]
    else:
        if sd[S[i]]!=T[i]:
            cond=False
            break
    if T[i] not in td:
        td[T[i]]=S[i]
    else:
        if td[T[i]]!=S[i]:
            cond=False
            break

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

Solution (Python):
S = list(input())
T = list(input())
s_appeared = [0] * 26
t_appeared = [0] * 26
for i in range(len(S)):
    if S[i] != T[i]:
        s_temp = s_appeared[ord(S[i])-97]
        if s_temp == 0:
            s_appeared[ord(S[i])-97] = T[i]
        else:
            if T[i] != s_temp:
                print('No')
                break

        t_temp = t_appeared[ord(T[i])-97]
        if t_temp == 0:
            t_appeared[ord(T[i])-97] = S[i]
        else:
            if S[i] != t_temp:
                print('No')
                break
    else:
        s_appeared[ord(S[i])-97] = T[i]
        t_appeared[ord(T[i])-97] = S[i]
else:
    print('Yes')

Solution (Python):
S = list(input())
T = list(input())
s_appeared = [0] * 26
t_appeared = [0] * 26
for i in range(len(S)):
    if S[i] != T[i]:
        s_temp = s_appeared[ord(S[i])-97]
        if s_temp == 0:
            s_appeared[ord(S[i])-97] = T[i]
        else:
            if T[i] != s_temp:
                print('No')
                break

        t_temp = t_appeared[ord(T[i])-97]
        if t_temp == 0:
            t_appeared[ord(T[i])-97] = S[i]
        else:
            if S[i] != t_temp:
                print('No')
                break
    else:
        s_appeared[ord(S[i])-97] = T[i]
        t_appeared[ord(T[i])-97] = S[i]
else:
    print('Yes')

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

memo = []

def swap(word,x,y):
	word=word.replace(x,'+')
	word=word.replace(y,'-')
	word=word.replace('+',y)
	word=word.replace('-',x)
	return word
	
for i in range(len(a)):
	if a[i] != b[i]:
		if a[i] in memo or b[i] in memo:
			print('No')
			break
		else:
			a=swap(a,a[i],b[i])
			memo.append(a[i])
			memo.append(b[i])
	
else:
	if a==b:
		print('Yes')
	else:
		print('No')

Solution (Python):
import sys

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

start=[-1 for _ in range(26)]
goal=[-1 for _ in range(26)]

for i in range(len(s)):
  a=int(ord(s[i]))-97
  b=int(ord(t[i]))-97

  if start[a]!=-1 or goal[b]!=-1:
    if start[a]!=b or goal[b]!=a:
      print('No')
      sys.exit()
  start[a]=b
  goal[b]=a

print('Yes')

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

Solution (Python):






import sys
input = sys.stdin.readline

import math

import bisect
from collections import defaultdict
from collections import deque
from functools import lru_cache






MOD = 10**9+7
INF = float('inf')






def I(): return int(input().strip())
def S(): return input().strip()
def IL(): return list(map(int,input().split()))
def SL(): return list(map(str,input().split()))
def ILs(n): return list(int(input()) for _ in range(n))
def SLs(n): return list(input().strip() for _ in range(n))
def ILL(n): return [list(map(int, input().split())) for _ in range(n)]
def SLL(n): return [list(map(str, input().split())) for _ in range(n)]


def P(arg): print(arg); return
def Y(): print("Yes"); return
def N(): print("No"); return
def E(): exit()
def PE(arg): print(arg); exit()
def YE(): print("Yes"); exit()
def NE(): print("No"); exit()


def DD(arg): return defaultdict(arg)



def inv(n): return pow(n, MOD-2, MOD)


kaijo_memo = []
def kaijo(n):
  if(len(kaijo_memo) > n):
    return kaijo_memo[n]
  if(len(kaijo_memo) == 0):
    kaijo_memo.append(1)
  while(len(kaijo_memo) <= n):
    kaijo_memo.append(kaijo_memo[-1] * len(kaijo_memo) % MOD)
  return kaijo_memo[n]

gyaku_kaijo_memo = []
def gyaku_kaijo(n):
  if(len(gyaku_kaijo_memo) > n):
    return gyaku_kaijo_memo[n]
  if(len(gyaku_kaijo_memo) == 0):
    gyaku_kaijo_memo.append(1)
  while(len(gyaku_kaijo_memo) <= n):
    gyaku_kaijo_memo.append(gyaku_kaijo_memo[-1] * pow(len(gyaku_kaijo_memo),MOD-2,MOD) % MOD)
  return gyaku_kaijo_memo[n]

def nCr(n,r):
  if(n == r):
    return 1
  if(n < r or r < 0):
    return 0
  ret = 1
  ret = ret * kaijo(n) % MOD
  ret = ret * gyaku_kaijo(r) % MOD
  ret = ret * gyaku_kaijo(n-r) % MOD
  return ret


def factorization(n):
  arr = []
  temp = n
  for i in range(2, int(-(-n**0.5//1))+1):
    if temp%i==0:
      cnt=0
      while temp%i==0: 
        cnt+=1 
        temp //= i
      arr.append([i, cnt])
  if temp!=1:
    arr.append([temp, 1])
  if arr==[]:
    arr.append([n, 1])
  return arr


def make_divisors(n):
  divisors = []
  for i in range(1, int(n**0.5)+1):
    if n % i == 0:
      divisors.append(i)
      if i != n // i: 
        divisors.append(n//i)
  return divisors


def gcd(a, b):
    while b:
        a, b = b, a % b
    return a


def lcm(a, b):
    return a * b // gcd (a, b)


def count_bit(n):
  count = 0
  while n:
    n &= n -1
    count += 1
  return count


def base_10_to_n(X, n):
  if X//n:
    return base_10_to_n(X//n, n)+[X%n]
  return [X%n]

def base_n_to_10(X, n):
  return sum(int(str(X)[-i])*n**i for i in range(len(str(X))))


def int_log(n, a):
  count = 0
  while n>=a:
    n //= a
    count += 1
  return count





s = S()
T = S()
S = s
N = len(S)

dicS = DD(lambda: [])
dicT = DD(lambda: [])

for i in range(N):
  dicS[S[i]].append(i)
  dicT[T[i]].append(i)

l1 = list(dicS.values())
l2 = list(dicT.values())
l1.sort()
l2.sort()

if l1==l2:
  YE()
NE()

Solution (Python):
S=input()
T=input()
from collections import defaultdict
ds = defaultdict(str)
dt = defaultdict(str)
for s,t in zip(S,T):
  if ds[s]=='' or ds[s]==t:
    ds[s]=t
  else:
    print('No')
    exit(0)
  if dt[t]=='' or dt[t]==s:
    dt[t]=s
  else:
    print('No')
    exit(0)
print('Yes')

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

l = len(s)
d1 = dict()
d2 = dict()

for i in range(l):
    if s[i] not in d1:
        d1[s[i]] = t[i]
    elif d1[s[i]] != t[i]:
        print("No")
        exit()

for i in range(l):
    if t[i] not in d2:
        d2[t[i]] = s[i]
    elif d2[t[i]] != s[i]:
        print("No")
        exit()

print("Yes")