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):
def StringTransformation(s , t):

    taious = {}
    taiout = {}
    ans = "Yes"

    for i in range(len(s)):
        if t[i] in taiout.keys() and taiout[t[i]] != s[i]:
            ans = "No"
            break
        elif s[i] in taious.keys() and taious[s[i]] != t[i]:
            ans = "No"
            break
        else:
            taiout[t[i]] = s[i]
            taious[s[i]] = t[i]

    return ans

def main():
    s = str(input())
    t = str(input())
    print(StringTransformation(s , t))

if __name__ == '__main__':
    main()

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

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

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

Solution (Python):
S = input()
T = input()
n = len(S)
s_str = []
s_count = []
t_str = []
t_count = []
for i in range(n):
  if not S[i] in s_str:
    s_str.append(S[i])
    s_count.append(S.count(S[i]))
for i in range(n):
  if not T[i] in t_str:
    t_str.append(T[i])
    t_count.append(T.count(T[i]))
if s_count == t_count:
  print("Yes")
else:
  print("No")

Solution (Python):
s = [c for c in str(input())]
t = [c for c in str(input())]
from collections import Counter
s_cntr = sorted(Counter(s).values())
t_cntr = sorted(Counter(t).values())
if s_cntr == t_cntr: print('Yes')
else: print('No')

Solution (Python):
from collections import Counter
import io
import math

sam = sorted(Counter(input()).values())
tim = sorted(Counter(input()).values())

print("Yes" if tim==sam else "No")

Solution (Python):
import sys

S = input()
T = input()
alpha_map = {}
talpha_map = {}
for i in range(len(S)):
  s = S[i]
  t = T[i]
  if s in alpha_map.keys():
    if alpha_map[s] != t:
      print("No")
      sys.exit()
  if t in talpha_map.keys():
    if talpha_map[t] != s:
      print("No")
      sys.exit()
  alpha_map[s] = t
  talpha_map[t] = s
print("Yes")

Solution (Python):
def main():
    import sys
    input = sys.stdin.readline
    sys.setrecursionlimit(10**7)
    from collections import Counter, deque
    
    from itertools import combinations, permutations, accumulate, groupby
    
    from bisect import bisect_left,bisect_right
    from heapq import heapify, heappop, heappush
    from math import floor, ceil
    

    
    

    s = input().rstrip()
    t = input().rstrip()
    alphabet = 'abcdefghijklmnopqrstuvwxyz' 

    for a in alphabet:
        l1, l2 = [], []
        for i in range(len(s)):
            if t[i] == a:
                l1.append(s[i])
            if s[i] == a:
                l2.append(t[i])
        if len(set(l1)) > 1 or len(set(l2)) > 1:
            print('No')
            exit()
    print('Yes')

if __name__ == '__main__':
    main()

Solution (Python):
def main():
    import sys
    input = sys.stdin.readline
    sys.setrecursionlimit(10**7)
    from collections import Counter, deque
    
    from itertools import combinations, permutations, accumulate, groupby
    
    from bisect import bisect_left,bisect_right
    from heapq import heapify, heappop, heappush
    from math import floor, ceil
    

    
    

    s = input().rstrip()
    t = input().rstrip()
    alphabet = 'abcdefghijklmnopqrstuvwxyz' 

    for a in alphabet:
        l1, l2 = [], []
        for i in range(len(s)):
            if t[i] == a:
                l1.append(s[i])
            if s[i] == a:
                l2.append(t[i])
        if len(set(l1)) > 1 or len(set(l2)) > 1:
            print('No')
            exit()
    print('Yes')

if __name__ == '__main__':
    main()

Solution (Python):
def f(A):
    dct = {}
    B = []
    i = 0
    for a in A:
        try:
            dct[a]
        except:
            dct[a] = i
            i += 1
        B.append(dct[a])
    return B


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

Solution (Python):
def f(A):
    dct = {}
    B = []
    i = 0
    for a in A:
        try:
            B.append(dct[a])
        except:
            dct[a] = i
            B.append(dct[a])
            i += 1
    return B


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

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

s_c = []
t_c = []
for i in range(len(s)):
    s_c.append(s[i])
    t_c.append(t[i])
    
from collections import Counter
s_c = Counter(s_c)
t_c = Counter(t_c)
s_keys, s_values = zip(*s_c.most_common())
t_keys, t_values = zip(*t_c.most_common())

if s_values == t_values:
    print('Yes')
else:
    print('No')

Solution (Python):
s = input()
t = input()
 
s_c = []
t_c = []
for c in 'abcdefghijklmnopqrstuvwxyz':
    s_c.append(s.count(c))
    t_c.append(t.count(c))
s_c.sort()
t_c.sort()
if s_c == t_c:
    print('Yes')
else:
    print('No')

Solution (Python):
'''
from scipy.sparse.csgraph import shortest_path, floyd_warshall, dijkstra, bellman_ford, johnson, minimum_spanning_tree
from scipy.sparse import csr_matrix, coo_matrix, lil_matrix
import numpy as np
'''
from collections import deque, Counter, defaultdict
from itertools import product, permutations,combinations
from operator import itemgetter
from heapq import heappop, heappush
from bisect import bisect_left, bisect_right, bisect
from fractions import gcd
from math import ceil,floor, sqrt, cos, sin, pi, factorial
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10**8)
INF = float('inf')
MOD = 10**9+7

def main():
  S = input()
  T = input()
  dic = dict()
  bl = True
  for s,t in zip(S,T):
    if (s in dic) and (dic[s] != t):
      bl = False
      break
    dic[s] = t
  
  after = dic.values()
  if len(after)!=len(set(after)):
    bl = False
  
  print('Yes' if bl else 'No')
  
  
  
  
  
if __name__ == '__main__':
  main()

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



def encode(S):
  dict={}
  now=0
  result=""
  for s in S:
    if s not in dict.keys():
      dict[s]=str(now)
      now+=1
    result=result+dict[s]
  return result

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

Solution (Python):
def main():
    import copy
    s, t = input(), input()
    a = [[] for _ in range(26)]
    b = copy.deepcopy(a)
    for i, j in zip(s, t):
        x, y = map(lambda x: ord(x) - 97, [i, j])
        a[x].append(y)
        b[y].append(x)

    f = all(len(set(i)) <= 1 for i in a)
    g = all(len(set(i)) <= 1 for i in b)
    print("Yes" if f and g else "No")


if __name__ == '__main__':
    main()

Solution (Python):
mod = 10 ** 9 + 7
mod2 = 2**61+1
from collections import deque
import heapq
from bisect import bisect_left, insort_left, bisect_right

def iip(listed=True):
    ret = [int(i) for i in input().split()]
    if len(ret) == 1 and not listed:
        return ret[0]
    return ret

def iip_ord():
    return [ord(i) - ord("a") for i in input()]


def main():
    ans = solve()
    if ans is not None:
        print(ans)

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

    d1 = {}
    d2 = {}
    for s, t in zip(S, T):
        if t not in d1:
            if s in d2:
                return "No"
            d1[t] = s
            d2[s] = t

        if s not in d2:
            if t in d1:
                return "No"
            d1[t] = s
            d2[s] = t

            
        if d1[t] != s or d2[s] != t:
            return "No"
    print("Yes")





def fprint(s):
    for i in s:
        print(i)

def split_print_space(s):
    print(" ".join([str(i) for i in s]))


def split_print_enter(s):
    print("\n".join([str(i) for i in s]))


def koenai_saidai_x_index(sorted_list, n):
    l = 0
    r = len(sorted_list)
    if len(sorted_list) == 0:
        return False
    if sorted_list[0] > n:
        return False

    while r - l > 1:
        x = (l + r) // 2
        if sorted_list[x] == n:
            return x
        elif sorted_list[x] > n:
            r = x
        else:
            l = x
    return l


def searchsorted(sorted_list, n, side):
    if side not in ["right", "left"]:
        raise Exception("sideはrightかleftで指定してください")

    l = 0
    r = len(sorted_list)

    if n > sorted_list[-1]:
        
        return len(sorted_list)
    if n < sorted_list[0]:
        return 0

    while r - l > 1:
        x = (l + r) // 2
        if sorted_list[x] > n:
            r = x
        elif sorted_list[x] < n:
            l = x
        else:
            if side == "left":
                r = x
            elif side == "right":
                l = x

    if side == "left":
        if sorted_list[l] == n:
            return r - 1
        else:
            return r

    if side == "right":
        if sorted_list[l] == n:
            return l + 1
        else:
            return l


def soinsuu_bunkai(n):
    ret = []
    for i in range(2, int(n ** 0.5) + 1):
        while n % i == 0:
            n //= i
            ret.append(i)
        if i > n:
            break
    if n != 1:
        ret.append(n)
    return ret


def conbination(n, r, mod, test=False):
    if n <= 0:
        return 0
    if r == 0:
        return 1
    if r < 0:
        return 0
    if r == 1:
        return n
    ret = 1
    for i in range(n - r + 1, n + 1):
        ret *= i
        ret = ret % mod

    bunbo = 1
    for i in range(1, r + 1):
        bunbo *= i
        bunbo = bunbo % mod

    ret = (ret * inv(bunbo, mod)) % mod
    if test:
        
        pass
    return ret


def inv(n, mod):
    return power(n, mod - 2)


def power(n, p, mod_= mod):
    if p == 0:
        return 1
    if p % 2 == 0:
        return (power(n, p // 2, mod_) ** 2) % mod_
    if p % 2 == 1:
        return (n * power(n, p - 1, mod_)) % mod_


if __name__ == "__main__":
    main()

Solution (Python):
import collections
S=list(input())
T=list(input())
values1=[]
values2=[]
flag=1

c=collections.Counter(S)
values1=list(c.values())	
c2=collections.Counter(T)
values2=list(c2.values())	

values1.sort()
values2.sort()

if len(values2)!=len(values1):
    flag=0
else:
    for i in range(len(values2)):
        if values1[i]!=values2[i]:
            flag=0
            break
if flag==0:
    print("No")
else:
    print("Yes")

Solution (Python):
s = input()
t = input()
dic1 = {}
dic2 = {}

for i in range(len(s)):
    if s[i] in dic1.keys():
        if dic1[s[i]]!=t[i]:
            print("No")
            exit()
    else:
        dic1[s[i]] = t[i]

for i in range(len(t)):
    if t[i] in dic2.keys():
        if dic2[t[i]]!=s[i]:
            print("No")
            exit()
    else:
        dic2[t[i]] = s[i]

print("Yes")

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


s.sort()
t.sort()


al = ['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']

arr1 = [0] * 26
arr2 = [0] * 26


for i in range(len(s)):
    arr1[ord(s[i]) - 97] += 1

for i in range(len(t)):
    arr2[ord(t[i]) - 97] += 1

arr1.sort()
arr2.sort()

if arr1 == arr2:
    print('Yes')
else:
    print('No')

Solution (Python):
s = input()
t = input()
dic = {}
n = len(s)
for i in range(n):
    if s[i] in dic:
        if dic[s[i]] != t[i]:
            print("No")
            exit()
    else:
        dic[s[i]] = t[i]
if len(dic.values()) != len(set(dic.values())):
    print("No")
else:
    print("Yes")

Solution (Python):
from collections import Counter
s = input()
t = input()
cnt_s = Counter(s)
cnt_t = Counter(t)
for i in range(len(s)):
    if cnt_s[s[i]] != cnt_t[t[i]]:
        print("No")
        exit()
print("Yes")

Solution (Python):


import sys
import math
from bisect import bisect_right as br
from bisect import bisect_left as bl
sys.setrecursionlimit(2147483647)
from heapq import heappush, heappop,heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collections import deque
from operator import itemgetter
from itertools import permutations
mod = 10**9 + 7
inf = float('inf')
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))

s = input()
t = input()
if len(list(Counter(s).values())) != len(list(Counter(t).values())):
    print('No')
    quit()
n = len(s)
S = [-1]*26
for i in range(n):
    sidx = ord(s[i]) - ord("a")
    tidx = ord(t[i]) - ord("a")
    if S[tidx] < 0:
        S[tidx] = sidx
    else:
        if S[tidx] != sidx:
            print('No')
            quit()
print('Yes')

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

Solution (Python):
from collections import Counter
S = input()
T = input()
cs = Counter(S)
ct = Counter(T)
if len(cs) != len(ct):
  print("No")
  exit()
else:
  if sorted(cs.values()) != sorted(ct.values()):
    print("No")
    exit()
  else:
    print("Yes")

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

start = [-1 for _ in range(26)]
goal  = [-1 for _ 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')
			exit()

	else:
		start[a] = b
		goal[b]  = a

print('Yes')

Solution (Python):
def str2int(s):
  res = ''
  dict = {}
  index = 0
  for c in s:
    if not c in dict.keys():
      dict[c] = index
      index += 1
    res = res + str(dict[c])
  return res
    
s = input()
t = input()
print('Yes' if str2int(s) == str2int(t) else 'No')

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

s_f = [0 for _ in range(26)]
t_f = [0 for _ in range(26)]

for ss, tt in zip(s, t):
    s_f[ord(ss) - ord('a')] += 1
    t_f[ord(tt) - ord('a')] += 1

s_f.sort()
t_f.sort()

for ss, tt in zip(s_f, t_f):
    if ss != tt:
        print('No')
        exit()

print('Yes')

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

for k,v in zip(S,T):
  if d.get(k)!= None and d.get(k)!=v:
    print('No')
    exit()
  d[k]=v

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

Solution (Python):
s = str(input())
t = str(input())
d = {}
for k, v in zip(s, t):
    if d.get(k) != None and d.get(k) != v:
        print("No")
        exit()
    d[k] = v

if len(set(d.values())) == len(d):
    print("Yes")
else:
    print("No")

Solution (Python):
s=input()
t=input()
import sys
m=[-1]*26
mrev=[-1]*26
for i,j in enumerate(s):
    x=ord(j)-ord('a')
    y=ord(t[i])-ord('a')
    if m[x]==-1:
        m[x]=y
    elif m[x]!=y:
        print('No')
        sys.exit()
for i,j in enumerate(t):
    x=ord(j)-ord('a')
    y=ord(s[i])-ord('a')
    if mrev[x]==-1:
        mrev[x]=y
    elif mrev[x]!=y:
        print('No')
        sys.exit()
print('Yes')

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

Solution (Python):

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

trans = dict()
ans = True
for s, t in zip(S, T):
    if trans.get(s, t) != t:
        ans = False
        break
    trans[s] = t


print('Yes' if ans and len(set(trans.values())) == len(trans) else 'No')

Solution (Python):
a=input()
b=input()
dic_a={}
dic_b={}
for i in a:
    if i not in dic_a:
        dic_a[i]=1
    else:
        dic_a[i] += 1
for i in b:
    if i not in dic_b:
        dic_b[i]=1
    else:
        dic_b[i] += 1


print("Yes" if (sorted(dic_a.values())==sorted(dic_b.values())) else "No" )

Solution (Python):
a=input()
b=input()
dic_a={}
dic_b={}
for i in a:
    if i not in dic_a:
        dic_a[i]=1
    else:
        dic_a[i] += 1
for i in b:
    if i not in dic_b:
        dic_b[i]=1
    else:
        dic_b[i] += 1


print("Yes" if (sorted(dic_a.values())==sorted(dic_b.values())) else "No" )

Solution (Python):
def main():
    import collections
    S = input()
    T = input()
    N = len(S)
    table = collections.defaultdict(int)
    table2 = collections.defaultdict(int)
    flag = True
    for i in range(N):
        x = S[i]
        y = T[i]

        if x in table:
            if y == T[table[x]]:
                continue
            else:
                flag = False
                break
        else:
            if y in table2:
                flag = False
                break
            table[x] = i
            table2[y] = i

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


main()

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

Solution (Python):
def cidx(c):
    return ord(c) - ord('a')

def main():
    s = input()
    t = input()
    si = 1
    ti = 1
    sl = [0] * 26
    tl = [0] * 26
    ans = True
    for i in range(len(s)):
        sidx = 0
        tidx = 0
        sc = cidx(s[i])
        tc = cidx(t[i])

        if sl[sc] != 0:
            sidx = sl[sc]
        else:
            sidx = si
            sl[sc] = si
            si += 1

        if tl[tc] != 0:
            tidx = tl[tc]
        else:
            tidx = ti
            tl[tc] = ti
            ti += 1
        
        if sidx != tidx:
            ans = False
            break
    
    yn = "Yes" if ans else "No"
    print(yn)


            

if __name__ == '__main__':
    main()

Solution (Python):
from collections import Counter
s = input()
t = input()
s_cnt = sorted(Counter(s).values(), reverse=True)
t_cnt = sorted(Counter(t).values(), reverse=True)
if s_cnt == t_cnt:
    print('Yes')
else:
    print('No')

Solution (Python):
def ii():return int(input())
def iim():return map(int,input().split())
def iil():return list(map(int,input().split()))
def ism():return map(str,input().split())
def isl():return list(map(str,input().split()))

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

l='abcdefghijklmnopqrstuvwxyz'

for item in l:
    can = [i for i, x in enumerate(t) if x == item]

    if len(can) > 1:
        d = [s[i] for i in can]
        if len(set(d)) != 1:
            print('No')
            exit()
for item in l:
    can = [i for i, x in enumerate(s) if x == item]

    if len(can) > 1:
        d = [t[i] for i in can]
        if len(set(d)) != 1:
            print('No')
            exit()
print('Yes')

Solution (Python):
def main():
    s = input()
    t = input()
    si = 0
    ti = 0
    sm = dict()
    tm = dict()
    ans = True
    for i in range(len(s)):
        sidx = 0
        if s[i] in sm:
            sidx = sm[s[i]]
        else:
            sidx = si
            sm[s[i]] = si
            si += 1

        tidx = 0
        if t[i] in tm:
            tidx = tm[t[i]]
        else:
            tidx = ti
            tm[t[i]] = ti
            ti += 1
        
        if sidx != tidx:
            ans = False
            break
    
    yn = "Yes" if ans else "No"
    print(yn)


            

if __name__ == '__main__':
    main()

Solution (Python):
from collections import defaultdict as dd
s=input()
t=input()
ds=dd(int)
dt=dd(int)
for ss in s:
    ds[ss]+=1
for tt in t:
    dt[tt]+=1
cs,ct=[],[]

for v in ds.values():
    cs.append(v)
for v in dt.values():
    ct.append(v)
cs.sort()
ct.sort()

for sss,ttt in zip(cs,ct):
    if sss!=ttt:
        print('No')
        exit()
print('Yes')

Solution (Python):
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline

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

cnt = [[0] * 26 for i in range(26)]

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

for j in range(26):
    n = 0
    for i in range(26):
        if cnt[i][j] != 0:
            n += 1
    if n > 1:
        print("No")
        exit(0)

for i in range(26):
    n = 0
    for j in range(26):
        if cnt[i][j] != 0:
            n += 1
    if n > 1:
        print("No")
        exit(0)

print("Yes")

Solution (Python):
import string
import sys
S = input()
T = input()
sLst = [0] * 26
tLst = [0] * 26

for i in range(26):
    sLst[i] = S.count(string.ascii_lowercase[i])
    tLst[i] = T.count(string.ascii_lowercase[i])
sLst.sort(reverse=True)
tLst.sort(reverse=True)

for i in range(26):
    if sLst[i] != tLst[i]:
        print('No')
        sys.exit()

print('Yes')

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

dic_s = {}
dic_t = {}

for i, j in zip(s, t):
    if i not in dic_s.keys():
        dic_s[i] = 1
    else:
        dic_s[i] += 1
    if j not in dic_t.keys():
        dic_t[j] = 1
    else:
        dic_t[j] += 1

dic_s = sorted(dic_s.items(), key=lambda x: x[1])
dic_t = sorted(dic_t.items(), key=lambda x: x[1])

for i in range(min(len(dic_s), len(dic_t))):
    if dic_s[i][1] != dic_t[i][1]:
        print('No')
        exit()
print('Yes')

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

    table = collections.defaultdict(set)
    table2 = collections.defaultdict(set)
    a = []
    b = []

    for i, xy in enumerate(zip(S, T)):
        x, y = xy
        if x not in table:
            a.append(i)
        if y not in table2:
            b.append(i)

        table[x].add(i)
        table2[y].add(i)

    flag = True

    if a != b:
        flag = False

    for i in a:
        if flag:
            if table[S[i]] == table2[T[i]]:
                continue
            else:
                flag = False
                break
    if flag:
        print("Yes")
    else:
        print("No")


main()

Solution (Python):
from collections import Counter, deque






import sys
sys.setrecursionlimit(10 ** 5 + 10)


def resolve():

    S=list(input())
    T=list(input())
    SS=Counter(S).most_common()
    TT=Counter(T).most_common()

    def main():

        if len(SS)!=len(TT):
            return 'No'
        else:
            for i in range(len(SS)):
                if SS[i][1]!=TT[i][1]:
                    return 'No'
            return 'Yes'
    print(main())

resolve()

Solution (Python):
def main():
    S = input()
    T = input()
    from collections import defaultdict
    tran = defaultdict(set)
    rtran = defaultdict(set)
    for s, t in zip(S, T):
        tran[s].add(t)
        rtran[t].add(s)
    if all(len(v) <= 1 for v in tran.values()) and \
            all(len(v) <= 1 for v in rtran.values()):
        print("Yes")
    else:
        print("No")


if __name__ == '__main__':
    main()

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

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

tToS = {}
sToT = {}
for s, t in zip(S, T):
    if not t in tToS:
        tToS[t] = s
    if not s in sToT:
        sToT[s] = t

    if tToS[t] != s or sToT[s] != t:
        print('No')
        exit()

print('Yes')

Solution (Python):
S = input()
T = input()
dic_S = {}
dic_T = {}
for i in range(len(S)):
    if S[i] not in dic_S:
        dic_S[S[i]] = T[i]
    elif dic_S[S[i]] != T[i]:
        print('No')
        exit()

    if T[i] not in dic_T:
        dic_T[T[i]] = S[i]
    elif dic_T[T[i]] != S[i]:
        print('No')
        exit()
print('Yes')

Solution (Python):
import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, acos, atan, asin
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd
def input(): return sys.stdin.readline().strip()
def STR(): return input()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def S_MAP(): return map(str, input().split())
def LIST(): return list(map(int, input().split()))
def S_LIST(): return list(map(str, input().split()))
sys.setrecursionlimit(10 ** 9)
inf = sys.maxsize
mod = 10 ** 9 + 7
dx = [0, 0, 1, -1, 1, -1, -1, 1]
dy = [1, -1, 0, 0, 1, -1, 1, -1]

s = STR()
t = STR()
l = len(s)
tmp = [[], []]
for i in range(len(s)):
    if not s[i] in tmp[0] and not t[i] in tmp[1]:
        tmp[0].append(s[i])
        tmp[1].append(t[i])
    else:
        if s[i] in tmp[0] and t[i] in tmp[1]:
            if tmp[0].index(s[i]) != tmp[1].index(t[i]):
                print('No')
                exit()
        else:
            print('No')
            exit()
print('Yes')

Solution (Python):
S = input()
T = input()
C = [-1]*26
for k in range(len(S)):
    if C[ord(T[k])-97] == -1:
        if ord(S[k])-97 in C:
            print("No")
            exit(0)
        else:
            C[ord(T[k])-97] = ord(S[k])-97
    else:
        if C[ord(T[k])-97] != ord(S[k])-97:
            print("No")
            exit(0)

print("Yes")

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

    n = len(s)

    charmap = dict()
    usedchar = set()

    for i in range(n):
        if s[i] not in charmap:
            if t[i] in usedchar:
                print('No')
                return
            charmap.update({s[i]: t[i]})
            usedchar.add(t[i])
        elif charmap[s[i]] != t[i]:
            print('No')
            return

    print('Yes')
    return


if __name__ == '__main__':
    main()

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

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

for _ in range(2):

    n = len(s)
    l = [set() for _ in range(26)]

    def f(c):
        return ord(c) - ord('a')

    for i, j in enumerate(s):
        l[f(j)].add(t[i])

    for i in l:
        if len(list(i)) > 1:
            print('No')
            exit(0)
        
    s,t = t,s

print('Yes')

Solution (Python):
import collections

S=input()
T=input()

def func(U):
    temp=dict(collections.Counter(U))
    lst=[]
    for v in temp.values():
        lst.append(v)
    return sorted(lst)


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

Solution (Python):
s = input()
t = input()
n = len(s)
r=[-1]*26
r2=[-1]*26
abcd = 'abcdefghijklmnopqrstuvwxyz'

def f(l,l2,R):
  for i in range(n):
    if R[abcd.index(l[i])]==-1 or R[abcd.index(l[i])]==l2[i]:
       R[abcd.index(l[i])]=l2[i]
    else:
       print("No")
       exit()

f(s,t,r)
f(t,s,r2)
print("Yes")

Solution (Python):
import sys













readline = sys.stdin.readline
MOD = 10 ** 9 + 7
INF = float('INF')
sys.setrecursionlimit(10 ** 5)


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

    l = len(s)

    sn = [0] * l
    tn = [0] * l
    sd = dict()
    td = dict()

    cnt = 0
    for i in range(l):
        c = s[i]
        if c in sd.keys():
            sn[i] = sd[c]
        else:
            cnt += 1
            sd[c] = cnt
            sn[i] = sd[c]
    cnt = 0
    for i in range(l):
        c = t[i]
        if c in td.keys():
            tn[i] = td[c]
        else:
            cnt += 1
            td[c] = cnt
            tn[i] = td[c]

    if all([sn[i] == tn[i] for i in range(l)]):
        print('Yes')
    else:
        print('No')

if __name__ == '__main__':
    main()

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

S = input().rstrip("\r\n")
T = input().rstrip("\r\n")
sc = Counter(S).values()
tc = Counter(T).values()
ans = "Yes" if sorted(sc) == sorted(tc) else "No"
print(ans)

Solution (Python):
import collections 

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

sans=[]
tans=[]

for v in s.values():
    sans.append(v)
for v in t.values():
    tans.append(v)
sans.sort()
tans.sort()

if sans==tans:
    print('Yes')
else:
    print('No')

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

slist,sdic=[],{}
tlist,tdic=[],{}
for i in range(len(S)):
  if not S[i] in sdic:
    sdic[S[i]]=len(sdic)+1
  slist.append(sdic[S[i]])
  
  if not T[i] in tdic:
    tdic[T[i]]=len(tdic)+1
  tlist.append(tdic[T[i]])



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

Solution (Python):
def main():
    S = input()
    T = input()
    s_to_t_dct = dict()
    t_to_s_dct = dict()

    answer = "Yes"

    for s,t in zip(S,T):
        if s in s_to_t_dct and s_to_t_dct[s] != t:
            answer = "No"
            break
        if t in t_to_s_dct and t_to_s_dct[t] != s:
            answer = "No"
            break
        s_to_t_dct[s] = t
        t_to_s_dct[t] = s
    print(answer)



if __name__ == '__main__':
    main()

Solution (Python):

s = input()
t = input()
n = len(s)

a = [0 for i in range(26)]
b = [0 for i in range(26)]

for i in range(n):
    a[ord(s[i])-ord("a")] += 1
    b[ord(t[i])-ord("a")] += 1



a.sort()
b.sort()

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

"""
from collections import Counter
S=input()
T=input()
SS=Counter(S)
TT=Counter(T)
if sorted(SS.values())==sorted(TT.values()):
  print('Yes')
else:
  print('No')

"""

Solution (Python):
from collections import Counter, defaultdict

s = Counter(input())
t = Counter(input())
unused_nums_s = defaultdict(int)
unused_nums_t = defaultdict(int)
for v in s.values():
  unused_nums_s[v] += 1
for v in t.values():
  unused_nums_t[v] += 1
print('Yes' if all(unused_nums_s[k] == unused_nums_t[k] for k in unused_nums_s) else 'No')

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

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

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

a = [0 for i in range(26)]
b = [0 for i in range(26)]

for i in range(n):
    a[ord(s[i])-ord("a")] += 1
    b[ord(t[i])-ord("a")] += 1
    
a.sort()
b.sort()

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

Solution (Python):
s=input();d=input()
l=('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')
for a,c in zip(sorted([s.count(i)for i in l]),sorted([d.count(i)for i in l])):
  if a!=c:print("No");exit()
print("Yes")

Solution (Python):
s=input();d=input();n=len(s)
di={"abcdefghijklmnopqrstuvwxyz"[i]:i for i in range(26)}
sl,dl=[set() for _ in range(26)],[set() for _ in range(26)]
for i,(x,y) in enumerate(zip(s,d)):
  sl[di[x]].add(i);dl[di[y]].add(i)
for i in dl:
  if i and i not in sl :print("No");exit() 
print("Yes")