Problem:
 Score : 300 points    Problem Statement You are given strings S and T consisting of lowercase English letters.  You can perform the following operation on S any number of times:  Operation: Choose two distinct lowercase English letters c_1 and c_2 , then replace every occurrence of c_1 with c_2 , and every occurrence of c_2 with c_1 .  Determine if S and T can be made equal by performing the operation zero or more times.      Constraints  1 \leq |S| \leq 2 \times 10^5  |S| = |T|  S and T consists of lowercase English letters.         Input Input is given from Standard Input in the following format:  S  T       Output If S and T can be made equal, print Yes ; otherwise, print No .        Sample Input 1 azzel
apple      Sample Output 1 Yes  azzel can be changed to apple , as follows:   Choose e as c_1 and l as c_2 . azzel becomes azzle .  Choose z as c_1 and p as c_2 . azzle becomes apple .        Sample Input 2 chokudai
redcoder      Sample Output 2 No  No sequences of operation can change chokudai to redcoder .       Sample Input 3 abcdefghijklmnopqrstuvwxyz
ibyhqfrekavclxjstdwgpzmonu      Sample Output 3 Yes

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











sn=[0 for i in range(26)]
tn=[0 for i in range(26)]
for i in range(len(s)):
    sn[ord(s[i])-ord('a')]+=1
    tn[ord(t[i])-ord('a')]+=1
print('Yes' if sorted(sn) == sorted(tn) else 'No')

Solution (Python):
from collections import Counter
 
s = input()
t = input()
 
c1 = Counter(s).most_common()
c2 = Counter(t).most_common()
 
for i, j in zip(c1, c2):
  if i[1] != j[1]:
    print('No')
    break
else:
  print('Yes')

Solution (Python):
import sys, os

f = lambda:list(map(int,input().split()))
if 'local' in os.environ :
    sys.stdin = open('./input.txt', 'r')

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

    sn = ''
    c_n = {}
    for i in s:
        if i not in c_n:
            c_n[i] = len(c_n)
        sn += str(c_n[i])
    
    tn = ''
    c_n = {}
    for i in t:
        if i not in c_n:
            c_n[i] = len(c_n)
        tn += str(c_n[i])


    if sn == tn:
        print('Yes')
    else:
        print('No')


solve()

Solution (Python):
from collections import Counter
 
s = input()
t = input()
 
c1 = Counter(s).most_common()
c2 = Counter(t).most_common()
 
for i, j in zip(c1, c2):
  if i[1] != j[1]:
    print('No')
    break
else:
  print('Yes')

Solution (Python):
from collections import Counter

s = input()
t = input()

c1 = Counter(s).most_common()
c2 = Counter(t).most_common()

for x, y in zip(c1, c2):
  if x[1] != y[1]:
    print('No')
    break
else:
  print('Yes')

Solution (Python):
from sys import stdin

S = stdin.readline().rstrip()
T = stdin.readline().rstrip()
alphabet = 'abcdefghijklmnopqrstuvwxyz'
cnt = 0

for letter in alphabet:
    X = []
    Y = []
    for k in range(len(T)):
        if T[k] == letter:
            X.append(S[k])
            if len(X) > 1 and X[len(X) - 1] != X[len(X) - 2]:
                print('No')
                break
        if S[k] == letter:
            Y.append(T[k])
            if len(Y) > 1 and Y[len(Y) - 1] != Y[len(Y) - 2]:
                print('No')
                break
    if len(X) > 1 and X[len(X) - 1] != X[len(X) - 2]:
        break
    if len(Y) > 1 and Y[len(Y) - 1] != Y[len(Y) - 2]:
        break
    cnt += 1

if cnt == 26:
    print('Yes')

Solution (Python):
Sp = list(input())
Tp = list(input())
S = [ord(Sp[i])-ord('a') for i in range(len(Sp))]
T = [ord(Tp[i])-ord('a') for i in range(len(Tp))]
lis = [-1]*26
lit = [-1]*26
ans = True
for i in range(len(S)):
    if lis[S[i]] == -1:
        lis[S[i]] = T[i]
    else:
        if lis[S[i]] != T[i]:
            ans = False
            break
for i in range(len(T)):    
    if lit[T[i]] == -1:
        lit[T[i]] = S[i]
    else:
        if lit[T[i]] != S[i]:
            ans = False
            break
if ans:
    print('Yes')
else:
    print('No')

Solution (Python):
from collections import Counter
s=input()
t=input()
cs=Counter(s).most_common()
ct=Counter(t).most_common()
if len(cs)==len(ct):
    for i in range(len(cs)):
        if cs[i][1]!=ct[i][1]:
            print("No")
            break
    else:print("Yes")
else:print("No")

Solution (Python):
S = list(input())
T = list(input())
s_element = list(set(S))
t_element = list(set(T))
s_count = [0]*(len(s_element))
t_count = [0]*(len(t_element))
for i in range(len(s_element)):
    s_count[i] = S.count(s_element[i])
for i in range(len(t_element)):
    t_count[i] = T.count(t_element[i])
x = sorted(s_count)
y = sorted(t_count)
print("Yes" if x==y else "No")

Solution (Python):
from sys import stdin
from collections import OrderedDict
reference_data = OrderedDict()

S = stdin.readline().rstrip()
T = stdin.readline().rstrip()
s = OrderedDict()
t = OrderedDict()
for a,b in zip(S,T):
    s[a] = set()
    t[b] = set()
for ind,i in enumerate(S):
    s[i].add(ind)
for ind,j in enumerate(T):
    t[j].add(ind)
if list(s.values()) == list(t.values()):
    print("Yes")
else:
    print("No")

Solution (Python):

import copy

S = input()
T = input()

def change(string, c1, c2):
    ret = []
    for s in string:
        if s is c1:
            ret.append(c2)
        elif s is c2:
            ret.append(c1)
        else:
            ret.append(s)
    return ret

S_ = copy.deepcopy(S)
history = []

while True:
    if S_ in history:
        print('No')
        exit()
    history.append(S_)
    for i, s in enumerate(S_):
        if s is not T[i]:
            S_ = copy.deepcopy(''.join(change(S_, s, T[i])))
            break
        if i == len(S_)-1:
            print('Yes')
            exit()

Solution (Python):
import copy

S = input()
T = input()

def change(string, c1, c2):
    ret = []
    for s in string:
        if s is c1:
            ret.append(c2)
        elif s is c2:
            ret.append(c1)
        else:
            ret.append(s)
    return ret

S_ = copy.deepcopy(S)
history = []

while True:
    if S_ in history:
        print('No')
        exit()
    for i, s in enumerate(S_):
        history.append(S_)
        if s is not T[i]:
            S_ = copy.deepcopy(''.join(change(S_, s, T[i])))
            break
        if i == len(S_)-1:
            print('Yes')
            exit()

Solution (Python):

import sys

YES = "Yes"  
NO = "No"  

def solve(S: str, T: str):

    stdic = {}
    for s,t in zip(S,T):
        if s not in stdic:
            stdic[s] = t
        else:
            if stdic[s] != t:
                print(NO)
                return

    checkv = []
    for k,v in stdic.items():
        checkv.append(v)


    if len(checkv) == len(set(checkv)):
        print(YES)
    else:
        print(NO)

    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):
S, T = open(0).read().split()
m1, m2 = {}, {}
for s, t in zip(S, T):
    if s in m1:
        m1[s].add(t)
    else:
        m1[s] = set(t)
    if t in m2:
        m2[t].add(s)
    else:
        m2[t] = set(s)
for v1, v2 in zip(m1.values(), m2.values()):
    if len(v1) != 1 or len(v2) != 1:
        print('No')
        exit()
print('Yes')

Solution (Python):
S = list(input())
T = list(input())
 
test = [-1] * 26
test2 = [-1] * 26

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

    if (test[a] != -1) or test2[b] != -1:
        if test[a] != b or test2[b] != a:
           print("No")
           exit()

    else:
        test[a] = b
        test2[b] = a


print("Yes")

Solution (Python):

"""
Created on Sun May 19 14:58:59 2019

@author: Yamazaki Kenichi
"""

S = input()
T = input()
N = len(S)
flg = True
x ={}
for i in range(N):
    try:
        if x[S[i]] == T[i]:
            continue
        else:
            flg = False
    except:
        x[S[i]] = T[i]
x ={}
for i in range(N):
    try:
        if x[T[i]] == S[i]:
            continue
        else:
            flg = False
    except:
        x[T[i]] = S[i]
if flg:
    print('Yes')
else:
    print('No')

Solution (Python):

"""
C - String Transformation
https://atcoder.jp/contests/abc110/tasks/abc110_c

"""
import sys

def sovle(S, T):
    st_d = dict()
    ts_d = dict()
    for s, t in zip(S, T):
        if s not in st_d:
            st_d[s] = t
        else:
            if st_d[s] != t:
                return 'No'
        if t not in ts_d:
            ts_d[t] = s
        else:
            if ts_d[t] != s:
                return 'No'
    return 'Yes'


def main(args):
    S = input()
    T = input()
    ans = sovle(S, T)
    print(ans)


if __name__ == '__main__':
    main(sys.argv[1:])

Solution (Python):
s1 = input().strip()
s2 = input().strip()
F = True
d = {}
s = {}
for i in range(len(s1)):
  if s2[i] not in s:
     s[s2[i]] = s1[i]
  elif s[s2[i]] != s1[i]:
      F = False
      break
  if s1[i] not in d:
      d[s1[i]] = s2[i]
  elif d[s1[i]] != s2[i]:
       F = False
       break
if F:
   print('Yes')
else:
   print('No')

Solution (Python):

"""
Created on Fri May 17 00:23:37 2019

@author: avina
"""

s1 = input().strip()
s2 = input().strip()
F = True
d = {}
s = {}
for i in range(len(s1)):
  if s2[i] not in s:
     s[s2[i]] = s1[i]
  elif s[s2[i]] != s1[i]:
      F = False
      break
for i in range(len(s1)):
  if s1[i] not in d:
     d[s1[i]] = s2[i]
  elif d[s1[i]] != s2[i]:
      F = False
      break

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

Solution (Python):

"""
Created on Fri May 17 12:54:56 2019

@author: avina
"""

S = input()
T = input()
S_map = {}
T_map = {}
l = len(S)
k = 0
S_cnt = 0
T_cnt = 0
for i in range(l):
	s,t = S[i], T[i]
	if s in S_map:
		s_id = S_map[s]
	else:
		s_id = S_cnt
		S_map[s] = S_cnt
		S_cnt += 1
	if t in T_map:
		t_id = T_map[t]
	else:
		t_id = T_cnt
		T_map[t] = T_cnt
		T_cnt += 1
	if s_id != t_id:
		print("No");k+=1
		break
if k == 0:
    print("Yes")

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


def my_index_multi(l, x):
    return [i for i, _x in enumerate(l) if _x == x]


alphabet = [0] * 26
alphabet2 = [0] * 26

for i in range(97, 97+26):
    alphabet[i-97] = my_index_multi(S, chr(i))
    alphabet2[i-97] = my_index_multi(T, chr(i))

ans = 'Yes'
for i in range(26):
    if not alphabet[i]:
        continue
    else:
        if not alphabet[i] in alphabet2:
            ans = 'No'
            break

print(ans)

Solution (Python):
s = input()
t = input()
s_list = [-1 for i in range(26)]
t_list = [-1 for i in range(26)]
for i in range(len(s)):
    if s_list[ord(s[i]) - ord("a")] == -1:
        s_list[ord(s[i]) - ord("a")] = ord(t[i])
    else:
        if s_list[ord(s[i]) - ord("a")] != ord(t[i]):
            print("No")
            exit()
    if t_list[ord(t[i]) - ord("a")] == -1:
        t_list[ord(t[i]) - ord("a")] = ord(s[i])
    else:
        if t_list[ord(t[i]) - ord("a")] != ord(s[i]):
            print("No")
            exit()
print("Yes")

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

Solution (Python):
s = input()
t = input()
n = len(s)
p = [-1] * 26
q = [-1] * 26
b = True
for i in range(n):
    v = ord(s[i]) - ord('a')
    w = ord(t[i]) - ord('a')
    if p[v] != w:
        if p[v] == -1:p[v] = w
        else :b = False
    if q[w] != v:
        if q[w] == -1:q[w] = v
        else :b = False

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

Solution (Python):
S = input()
T = input()
st = {}
ts = {}
for s, t in zip(S, T):
  if st.get(s, t) != t:
    print('No')
    break
  else:
    st[s] = t
  if ts.get(t, s) != s:
    print('No')
    break
  else:
    ts[t] = s
else:
  print('Yes')

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

a = "abcdefghijklmnopqrstuvwxyz"
b = [0]*26
flag = 0

for i in range(len(s)):
    tmp = a.index(s[i])
    if b[tmp] == 0:
        b[tmp] = t[i]
        if b.count(t[i]) > 1:
            flag = 1
            break
    elif b[tmp] != t[i] :
        flag = 1
        break

        
print("Yes" if flag == 0 else "No")

Solution (Python):
A = input()
B = input()

dA = [-1]*26
dB = [-1]*26
cA = 0
cB = 0
pA = []
pB = []

le = len(A)

for i in range(le):
  v = ord(A[i])-ord("a")
  if ( dA[v]==-1 ):
    dA[v]=cA
    pA.append(cA)
    cA+=1
  else:
    pA.append( dA[v] )

for i in range(le):
  v = ord(B[i])-ord("a")
  if ( dB[v]==-1 ):
    dB[v]=cB
    pB.append(cB)
    cB+=1
  else:
    pB.append( dB[v] )

s = le
for i in range(le):
  if (pA[i]==pB[i]):
    s-=1
if (s==0):
  print ("Yes")
else:
  print ("No")

Solution (Python):
s=list(input())
t=list(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()
N = len(S)

X = {}
for i in range(N):
  if T[i] not in X.keys():
    X[T[i]] = []
  X[T[i]].append(S[i])
Y = {}
for i in range(N):
  if S[i] not in Y.keys():
    Y[S[i]] = []
  Y[S[i]].append(T[i])

for i,j in X.items():
  if len(set(j)) >= 2:
    print('No')
    exit()
for i,j in Y.items():
  if len(set(j)) >= 2:
    print('No')
    exit()
print('Yes')

Solution (Python):
A = input()
B = input()

flag = True
if len(A) != len(B):
  flag = False 

pair_dict = dict()
reverse_dict = dict()
for i in range(len(A)):
  if A[i] not in pair_dict:
    pair_dict[A[i]] = B[i]
  elif pair_dict[A[i]] != B[i]:
    flag = False
    break
  if B[i] not in reverse_dict:
    reverse_dict[B[i]] = A[i]
  elif reverse_dict[B[i]] != A[i]:
    flag = False
    break
if flag:
  print("Yes")
else:
  print("No")

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

s_dic = {}
t_dic = {}
s_cnt = 0
t_cnt = 0
s_mod = ''
t_mod = ''
for i in range(0, len(s)):
  if s[i] not in s_dic:
    s_dic[s[i]] = s_cnt
    s_cnt += 1

  s_mod += str(s_dic[s[i]])
  
  if t[i] not in t_dic:
    t_dic[t[i]] = t_cnt
    t_cnt += 1
  
  t_mod += str(t_dic[t[i]])
  
if s_mod == t_mod:
  print('Yes')
else:
  print('No')

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

r1 = [-1] * 26
r2 = [-1] * 26


def char2index(char):
    return ord(char) - 97


sn = [char2index(si) for si in s]
tn = [char2index(ti) for ti in t]

flg = True
for si, ti in zip(sn, tn):
    if r1[si] >= 0:
        if r1[si] != ti:
            flg = False
            break
    else:
        r1[si] = ti
    if r2[ti] >= 0:
        if r2[ti] != si:
            flg = False
            break
    else:
        r2[ti] = si

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

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

mapping = {}
for s, t in zip(S, T):
    if s not in mapping and t not in mapping.values():
        mapping[s] = t
    elif s not in mapping and t in mapping.values():
        print('No')
        break
    elif mapping[s] != t:
        print('No')
        break
else:
    print('Yes')

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

def main(S, T):
    seen = {}

    for i in range(len(S)):
        if S[i] not in seen:
            seen[S[i]] = T[i]
        else:
            if seen[S[i]] != T[i]:
                return 0
    return 1

ans = main(s, t)*main(t, s)
if ans == 1:
    print("Yes")
else:
    print("No")

Solution (Python):
import sys

s = input().strip()
t = input().strip()

d = dict()
for i, sc in enumerate(s):
    tc = t[i]

    if sc in d:
        if d[sc] == tc:
            continue
        else:
            print('No')
            sys.exit(0)

    d[sc] = tc

vs = list(d.values())
for v in vs:
    if vs.count(v) > 1:
        print('No')
        sys.exit(0)

print('Yes')

Solution (Python):
s = input()
t = input()
a_z = 'abcdefghijklmnopqrstuvwxyz'
D1 = dict(zip([c for c in a_z],[-1 for _ in range(len(a_z))]))
D2 = dict(zip([c for c in a_z],[-1 for _ in range(len(a_z))]))
for x, y in zip(s, t):
    if D1[x] == -1:
        D1[x] = y
    else:
        if D1[x] != y:
            print('No')
            exit()
    if D2[y] == -1:
        D2[y] = x
    else:
        if D2[y] != x:
            print('No')
            exit()
else:
    print('Yes')

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


dic1 = dict()
dic2 = dict()
for i in range(len(S)):
    if not S[i] in dic1.keys():
        dic1[S[i]] = 1
    else:
        dic1[S[i]] += 1
    if not T[i] in dic2.keys():
        dic2[T[i]] = 1
    else:
        dic2[T[i]] += 1


dic1 = sorted(dic1.items(), key = lambda x:x[1])
dic2 = sorted(dic2.items(), key = lambda x:x[1])

for j in range(len(dic1)):
    if not dic1[j][1] == dic2[j][1]:
        print ('No')
        sys.exit()
print ('Yes')

Solution (Python):
s,t=input(),input()
s_set,t_set,st_set=set(),set(),set()
for i,j in zip(s,t):
    if i not in s_set and j not in t_set:
        s_set.add(i)
        t_set.add(j)
    elif (i,j) not in st_set:
        print("No")
        break
    st_set.add((i,j))
else:
    print("Yes")

Solution (Python):
s=input()
t=input()
S={}
T={}
for i in range(len(s)):
    if s[i] in S.keys() and t[i] in T.keys():
        if S[s[i]]!=T[t[i]]:
            print("No")
            exit()
        else:
            S[s[i]]+=1
            T[t[i]]+=1
    elif s[i] not in S.keys() and t[i] not in T.keys():
        S[s[i]]=1
        T[t[i]]=1
    else:
        print("No")
        exit()
print("Yes")

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

table = [[0 for i in range(26)] for j in range(26)]
for i in range(len(s)):
  table[ord(t[i])-ord('a')][ord(s[i])-ord('a')] += 1
for t_row in table:
  counter = 0
  for v in t_row:
    if v != 0:
      counter += 1
  if counter >= 2:
    break
else:
  for i in range(26):
    counter = 0
    for j in range(26):
      if table[j][i] != 0:
        counter += 1
    if counter >= 2:
      break
  else:
    print('Yes')
    exit(0)
print('No')

Solution (Python):
S = [c for c in input()]
T = [c for c in input()]
ST = [[s,t] for s,t in zip(S,T)]
S_dict = {}
T_dict = {}
for s,t in ST:
    if s not in S_dict:
        S_dict[s] = [t]
    elif t not in S_dict[s]:
        S_dict[s].append(t)
    if t not in T_dict:
        T_dict[t] = [s]
    elif s not in T_dict[t]:
        T_dict[t].append(s)

S_tmp = max([len(x) for x in S_dict.values()])
T_tmp = max([len(x) for x in T_dict.values()])
tmp = max(S_tmp, T_tmp)
flag = True if tmp < 2 else False
print('Yes' if flag else 'No')

Solution (Python):
from collections import defaultdict

S=input()
T=input()

ds={}
dt={}
for i in range(len(S)):
  if S[i] not in ds:
    ds[S[i]]=T[i]
  elif ds[S[i]]!=T[i]:
    print('No')
    exit()
  if T[i] not in dt:
    dt[T[i]]=S[i]
  elif dt[T[i]]!=S[i]:
    print('No')
    exit()
      
print('Yes')

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

char_map = {}
char_map_t = {}

result = 'Yes'

for s, t in zip(S, T):
    if s in char_map:
        if t == char_map[s]:
            continue
        else:
            result = 'No'
            break
    else:
        char_map[s] = t

    if t in char_map_t:
        if s == char_map_t[t]:
            continue
        else:
            result = 'No'
            break
    else:
        char_map_t[t] = s

print(result)

Solution (Python):
s=input()
t=input()
arr1=[0]*26
arr2=[0]*26
check='abcdefghijklmnopqrstuvwxyz'
for i in range(26):
  arr1[i]=s.count(check[i])
  arr2[i]=t.count(check[i])
arr1=sorted(arr1)
arr2=sorted(arr2)
for i in range(26):
  if arr1[i]!=arr2[i]:
    print('No')
    break
else:
  print('Yes')

Solution (Python):


from sys import stdout
from bisect import bisect_left as binl
from copy import copy, deepcopy

def intin():
    input_tuple = input().split()
    if len(input_tuple) <= 1:
        return int(input_tuple[0])
    return tuple(map(int, input_tuple))


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


def intinl(count):
    return [intin() for _ in range(count)]


def modadd(x, y):
    global mod
    return (x + y) % mod


def modmlt(x, y):
    global mod
    return (x * y) % mod


def lcm(x, y):
    while y != 0:
        z = x % y
        x = y
        y = z
    return x


def get_divisors(x):
    retlist = []
    for i in range(1, int(x**0.5) + 3):
        if x % i == 0:
            retlist.append(i)
            retlist.append(x // i)
    return retlist


def make_linklist(xylist):
    linklist = {}
    for a, b in xylist:
        linklist.setdefault(a, [])
        linklist.setdefault(b, [])
        linklist[a].append(b)
        linklist[b].append(a)
    return linklist


def calc_longest_distance(linklist, v=1):
    distance_list = {}
    distance_count = 0
    distance = 0
    vlist_previous = []
    vlist = [v]
    nodecount = len(linklist)

    while distance_count < nodecount:
        vlist_next = []
        for v in vlist:
            distance_list[v] = distance
            distance_count += 1
            vlist_next.extend(linklist[v])
        distance += 1
        vlist_to_del = vlist_previous
        vlist_previous = vlist
        vlist = list(set(vlist_next) - set(vlist_to_del))

    max_distance = -1
    max_v = None
    for v, distance in distance_list.items():
        if distance > max_distance:
            max_distance = distance
            max_v = v

    return (max_distance, max_v)


def calc_tree_diameter(linklist, v=1):
    _, u = calc_longest_distance(linklist, v)
    distance, _ = calc_longest_distance(linklist, u)
    return distance





def parse_str(x):
    ret = {}
    for i, c in enumerate(x):
        ret.setdefault(c, [])
        ret[c].append(i)
    return ret


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

    s_parse = parse_str(s)
    t_parse = parse_str(t)

    spos = [pos for pos in s_parse.values()]
    spos.sort()
    tpos = [pos for pos in t_parse.values()]
    tpos.sort()

    if spos == tpos:
        print('Yes')
    else:
        print('No')


if __name__ == '__main__':
    main()

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

s = input()
t = input()
ds = defaultdict(str)
dt = defaultdict(str)

ans = "Yes"
for c1, c2 in zip(s, t):
    if c1 not in ds:
        ds[c1] = c2
    else:
        if ds[c1] != c2:
            ans = "No"
    
    if c2 not in dt:
        dt[c2] = c1
    else:
        if dt[c2] != c1:
            ans = "No"
print(ans)

Solution (Python):
S, T=input(), input()
src, trg = {}, {}
for i in range(len(S)):
    s, t = S[i], T[i]
    if (s in src and src[s] != t) or (t in trg and trg[t] != s):
        print("No")
        exit()
    src[s] = t
    trg[t] = s
print("Yes")

Solution (Python):

s = str(input())
t = str(input())
memo = {}
ifadd = False
ifsamedest = False
destlist = set()
for i in range(len(s)):
    sor = s[i]
    des = t[i]
    if sor not in memo:
        memo[sor] = des
        if des in destlist:
            ifsamedest = True
        destlist.add(des)
    else:
        if memo[sor]!=des:
            ifadd = True






ans = "Yes"
visited = set()
if ifadd == True:
    ans = "No"
if ifsamedest == True:
    ans = "No"
else:
    for sta in memo:
        if sta not in visited:
            visited.add(sta)
            gol = memo[sta]
            fsta = sta
            while(gol!=sta):
                if gol not in memo:
                    gol = sta
                else:
                    sta,gol = gol,memo[gol]
                    visited.add(sta)
                    if gol == fsta:
                        gol = sta
                        
print(ans)

Solution (Python):
s1 = input()
s2 = input()
di1 = {} 
di2 = {} 

ans = "Yes"
for c1,c2 in zip(s1,s2):
    if c1 not in di1:
        di1[c1] = c2
    else:
        if di1[c1] != c2:
            ans = "No"

    if c2 not in di2:
        di2[c2] = c1
    else:
        if di2[c2] != c1:
            ans = "No"

print(ans)

Solution (Python):
s = input()
t = input()
from collections import defaultdict
dic1 = defaultdict(set)
dic2 = defaultdict(set)
for i in range(len(s)):
    dic1[s[i]].add(t[i])
    dic2[t[i]].add(s[i])
f = True
for c in dic1.keys():
    if len(dic1[c]) >= 2:
        f = False
        break
for c in dic2.keys():
    if len(dic2[c]) >= 2:
        f = False
        break
print("Yes" if f else "No")

Solution (Python):
import sys
s=input()
t=input()
s_dict={}
t_dict={}
for i in range(len(s)):
    if not s[i] in s_dict:
        s_dict[s[i]]=t[i]
    else:
        if s_dict[s[i]]==t[i]:
            pass
        else:
            print('No')
            sys.exit()
    if not t[i] in t_dict:
        t_dict[t[i]]=s[i]
    else:
        if t_dict[t[i]]==s[i]:
            pass
        else:
            print('No')
            sys.exit()
print('Yes')

Solution (Python):
S=input()
T=input()
char_dict={}
target_chatrs=[]
is_valid=True
for i in range(len(S)):
    if S[i] not in char_dict:
        if T[i] in target_chatrs:
            is_valid=False
            break
        char_dict[S[i]]=T[i]
        target_chatrs.append(T[i])
    else:
        if char_dict[S[i]]!=T[i]:
            is_valid=False
            break
if is_valid:
    print('Yes')
else:
    print('No')

Solution (Python):
import numpy as np
from copy import deepcopy

S = str(input())
T = str(input())

line_S = deepcopy(S)
line_T = deepcopy(T)

while True:
  if len(line_S) == 0:
    ans = 'Yes'
    break
  else:
    char_S = line_S[0]
    char_T = line_T[0]
    bool_S = [(s == char_S) for s in line_S]
    bool_T = [(t == char_T) for t in line_T]
    if bool_S == bool_T:
      line_S = line_S.replace(char_S, "")
      line_T = line_T.replace(char_T, "")
    else:
      ans = 'No'
      break
   
print(ans)

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

char_dict = {}
target_chars = []

is_valid = True
for i in range(len(S)):
    if S[i] in char_dict:
        if char_dict[S[i]] != T[i]:
            is_valid = False
            break
    else:
        if T[i] in target_chars:
            is_valid = False
            break
        char_dict[S[i]] = T[i]
        target_chars.append(T[i])

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

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

def compare(a, b):
    dict = {}
    flag = 1
    for i in range(len(a)):
        if a[i] in dict:
            dict[a[i]].append(i)
        else:
            dict[a[i]] = [i]
    for list in dict.values():
        bvals = [b[i] for i in list]
        if bvals.count(bvals[0]) != len(bvals):
            flag = 0
            break
    return flag

res = compare(s, t) * compare(t, s)
if res:
    print("Yes")
else:
    print("No")

Solution (Python):
S = input()
T = input()
N = len(S)
d = {}
d1 = {}
for i in range(N):
    if S[i] in d:
        if d[S[i]] != T[i]:
            print('No')
            exit()
    elif T[i] in d1:
        if d1[T[i]] != S[i]:
            print('No')
            exit()
    else:
        d[S[i]] = T[i]
        d1[T[i]] = S[i]

print('Yes')

Solution (Python):
from collections import Counter

S = input()
T = input()

S_cnt = Counter(S).most_common()
T_cnt = Counter(T).most_common()

if len(S_cnt) != len(T_cnt):
    print('No')
else:
    for i in range(len(S_cnt)):
        if S_cnt[i][1] != T_cnt[i][1]:
            print('No')
            exit()
    print('Yes')

Solution (Python):
import sys
S = input()
T = input()
alpha = []
rule = {}
for i in range(len(S)):
	if S[i] in rule.keys():
		if rule[S[i]] != T[i]:
			print('No')
			sys.exit()
	elif T[i] in rule.values():
		print('No')
		sys.exit()
	else:
		rule[S[i]] = T[i]
print('Yes')

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


dict_S = {}
dict_T = {}

for i in range(len(S)):
  if S[i] in dict_S:
    if dict_S[S[i]] != T[i]:
      print("No")
      exit()
  else:
    dict_S[S[i]] = T[i]
  
  if T[i] in dict_T:
    if dict_T[T[i]] != S[i]:
      print("No")
      exit()
  else:
    dict_T[T[i]] = S[i]
    
print("Yes")

Solution (Python):
s_in=input()
t_in=input()

dicword_s={}
dicword_t={}
for s,t in zip(s_in,t_in):
    if s in dicword_s:
        if t != dicword_s[s]:
            print("No")
            exit()
    else:
        dicword_s[s] = t

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

Solution (Python):

import sys
from math import *
from itertools import *
from collections import *
from functools import *
try:
    from math import gcd
except Exception:
    from fractions import gcd

YES = "Yes"  
NO = "No"  

def solve(S: str, T: str):
    ds = {}
    dt = {}
    cs = []
    ct = []
    for s, t in zip(S, T):
        if s in ds:
            cs.append(ds[s])
        else:
            cc = len(ds) + 1
            ds[s] = cc
            cs.append(cc)
        if t in dt:
            ct.append(dt[t])
        else:
            cc = len(dt) + 1
            dt[t] = cc
            ct.append(cc)
    return YES if cs == ct else NO


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)  
    result = solve(S, T)
    print(result)

if __name__ == '__main__':
    main()

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

def pattern(s):
  s_dict = {}
  pattern = [None for _ in range(len(s))]
  for i,c in enumerate(s):
    if not c in s_dict:
      s_dict[c] = len(s_dict)
    pattern[i] = s_dict[c]
  return pattern

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

Solution (Python):
from collections import Counter


def f(s, t):
    sc = Counter(s)
    tc = Counter(t)
    sn = [x for x in sc.values()]
    tn = [x for x in tc.values()]
    sn.sort()
    tn.sort()
    print("Yes") if sn == tn else print("No")


s = input()
t = input()
f(s, t)

Solution (Python):
from collections import Counter

s=input()
t=input()
sc=Counter(s)
tc=Counter(t)
sn=[x for x in sc.values()]
tn=[x for x in tc.values()]
sn.sort()
tn.sort()
print("Yes") if sn==tn else print("No")

Solution (Python):

import collections


S = input()
T = input()

cnt_S = collections.Counter(S)
cnt_T = collections.Counter(T)
S_values, S_counts = zip(*cnt_S.most_common())
T_values, T_counts = zip(*cnt_T.most_common())
if S_counts == T_counts:
    print('Yes')
else:
    print('No')

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

while s != '':
    if [i for i, x in enumerate(s) if x == s[0]] == [i for i, x in enumerate(t) if x == t[0]]:
        s = s.replace(s[0],'')
        t = t.replace(t[0],'')
    else:
        print('No')
        exit()

print('Yes')

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

while s != '':
    if [i for i, x in enumerate(s) if x == s[0]] == [i for i, x in enumerate(t) if x == t[0]]:
        s = s.replace(s[0],'')
        t = t.replace(t[0],'')
    else:
        print('No')
        exit()

print('Yes')

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

Rs = [-1 for x in range(26)]
Rt = [-1 for x in range(26)]

l = len(S)

for i in range(l):
    s = ord(S[i])-97
    t = ord(T[i])-97
    if Rs[s] == -1:
        Rs[s] = t
    else:
        if Rs[s] != t:
            print("No")
            exit()
    
    if Rt[t] == -1:
        Rt[t] = s
    else:
        if Rt[t] != s:
            print("No")
            exit()

print("Yes")

Solution (Python):


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

dics = {}
dicst= {}
sets = set()
sett = set()
flag = True
for i in range(len(S)):
    s = S[i]
    t = T[i]
    if s in sets and t in sett:
        if dics[s] != t or dicst[t] != s:
            flag = False
            break
    elif s in sets and not(t in sett):
        flag = False
        break
    elif t in sett and not(s in sets):
        flag = False
        break
    else:
        sets.add(s)
        sett.add(t)
        dics[s] = t
        dicst[t] = s
    
print('Yes') if flag else print('No')