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



Sample input:
azzel
apple


Sample output:
Yes

Submission status: Wrong Answer

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

sc = ["" for i in range(0, 26)]
tc = ["" for i in range(0, 26)]
scf = False
tcf = False
for i in range(0, len(s)):
    sci = sc[ord(s[i]) - ord('a')]
    if sci != "" and t[i] != sci:
        print("NO")
        scf = True
        break
    else:
        sc[ord(s[i]) - ord('a')] = t[i]

if not scf:
    for i in range(0, len(t)):
        tci = tc[ord(t[i]) - ord('a')]
        if tci != "":
            if t[i] == tci or t[i] == s[i]:
                print("NO")
                tcf = True
                break
        else:
            tc[ord(t[i]) - ord('a')] = s[i]

    if not tcf:
        print("YES")

Submission status: Wrong Answer

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

ans = 'Yes'
for si, ti in zip(s, t):
  if si == ti and t.count(ti) > 1:
    ans = 'No'
print(ans)

Submission status: Wrong Answer

Solution code:
s = list(input())
t = list(input())
    
box = [[]]
box2 = [[]]
for index,item in enumerate(t):
    box.append([item,s[index]])
for index,item in enumerate(s):
    box2.append([item,t[index]])
#print(box)
box.sort()
box2.sort()
del box[0]
del box2[0]
x = "test"
#print(box)
for index,item in enumerate(box):

    if item[0] == x and index != 0:
        #print(1)
        #print(box[index][1],box[index-1][1])
        if box[index][1] != box[index-1][1]:
            print("No",end="")
            exit()
    #print(item[0],item[1])
    x = item[0]
x = "test"
for index,item in enumerate(box2):

    if item[0] == x and index != 0:
        #print(1)
        #print(box[index][1],box[index-1][1])
        if box2[index][1] != box2[index-1][1]:
            #print("No",end="")
            exit()
    #print(item[0],item[1])
    x = item[0]
      
print("Yes",end="")

Submission status: Wrong Answer

Solution code:
s = list(input())
t = list(input())
if s == t:
    print("No",end="")
    exit()
    
box = [[]]
for index,item in enumerate(t):
    box.append([item,s[index]])
box.sort()
del box[0]
x = "test"
#print(box)
for index,item in enumerate(box):

    if item[0] == x and index != 0:
        #print(1)
        if box[index][1] != box[index-1][1]:
            print("No",end="")
            exit()
    #print(item[0],item[1])
    x = item[0]
      
print("Yes",end="")

Submission status: Wrong Answer

Solution code:
s = list(input())
t = list(input())
box = [[]]
for index,item in enumerate(t):
    box.append([item,s[index]])
box.sort()
del box[0]
x = "test"
#print(box)
for index,item in enumerate(box):

    if item[0] == x and index != 0:
        #print(1)
        if box[index][1] != box[index-1][1]:
            print("No",end="")
            exit()
    #print(item[0],item[1])
    x = item[0]
    
    
print("Yes",end="")

Submission status: Wrong Answer

Solution code:
str1 = list(input())
str2 = list(input())

n = len(str1)

for i in range(n):
    if str1[i]==str2[i]:
        continue
    for j in range(i+1,n):
        if str1[j]==str1[i]:
            tmp = str2[i]
            str2[i] = str1[j]
            str1[j] = tmp
            break
        elif str2[j] == str1[i]:
            tmp = str2[j]
            str2[j] = str1[i+1]
            str1[i+1] = str2[i]
            str2[i] = tmp
            break
str1 = ''.join(str1)
str2 = ''.join(str2) 

if(str1 == str2):
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
str1 = list(input())
str2 = list(input())

n = len(str1)

for i in range(n):
    if str1[i]==str2[i]:
        continue
    for j in range(i+1,n):
        if str1[j]==str1[i]:
            tmp = str2[i]
            str2[i] = str1[j]
            str1[j] = tmp
            break
        elif str2[j] == str1[i]:
            tmp = str2[j]
            str2[j] = str1[i+1]
            str1[i+1] = str2[i]
            str2[i] = tmp
            break
str1 = ''.join(str1)
str2 = ''.join(str2) 

if(str1 == str2):
    print("YES")
else:
    print("NO")

Submission status: Wrong Answer

Solution code:
s = [c for c in input()]
t = [c for c in input()]

diff = set()

for i in range(len(s)):
    if s[i] != t[i]:
        diff.add(s[i] + t[i])

print(diff)

for d in set(diff):
    diff.discard(d[1] + d[0])
    diff.discard(d)

if len(diff) > 0:
    print("No")
else:
    print("Yes")

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
A = list(input())
B = list(input())
A.sort()
B.sort()
A = list(set(A))
B = list(set(B))
if len(A) == len(B):
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
import collections as col

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

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

if set(c1.values()) == set(c2.values()):
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

Solution code:
s1 = raw_input()
s2 = raw_input()

dict1 = {}
dict2 = {}

for i in s1:
	dict1[i] = dict1.get(i,0)+1
for i in s2:
	dict2[i] = dict2.get(i,0)+1

values1 = sorted(dict1.values())
values2 = sorted(dict2.values())

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

Submission status: Wrong Answer

Solution code:
import sys
s = input()
t = input()
skip = []
for i in range(len(s)):
    if s[i]==t[i] or i in skip:
        continue
    else:
        l = []
        for j in range(i,len(t)):
            if t[i]==t[j]:
                l.append(j)
        for k in l:
            skip.append(k)
            if not s[i]==s[k]:
                print('No')
                sys.exit()
            if not s.count(s[i])==len(l):
                print('No')
                sys.exit()
        s = s.replace(s[i],t[i])
    if i==len(s)-1:
        print('Yes')
        sys.exit()
print('No')

Submission status: Wrong Answer

Solution code:
import sys
s = input()
t = input()
skip = []
for i in range(len(s)):
    if s[i]==t[i] or i in skip:
        continue
    else:
        l = []
        for j in range (i,len(t[i])):
            if t[i]==t[j]:
                l.append(j)
        for k in l:
            skip.append(k)
            if not s[i]==s[k] or not s.count(s[i])==len(l):
                print('No')
                sys.exit()
print('Yes')

Submission status: Wrong Answer

Solution code:
S = input()
T = input()
st = dict(zip(S, T))
ts = dict(zip(T, S))
if len(st) == len(ts):
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
s, t = input(), input()
same = set()
can = True
for i in range(len(s)):
    if s[i] == t[i]:
        same.add(s[i])
for i in range(len(s)):
    if s[i] != t[i]:
        if s[i] in same or t[i] in same:
            can = False
if can:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
import sys

def main():
  input = sys.stdin.readline
  S = str(input().strip())
  T = str(input().strip())
  
  C1, C2 = [], []
  ans = 'Yes'
  rep = dict()
  for c1, c2 in zip(S, T):
    if (c1 in rep) and (rep[c1] == c2):
      continue
    elif (c1 not in rep):
      rep[c1] = c2
    else:
      ans = 'No'
      break
  print(ans)


if __name__ == '__main__':
  main()

Submission status: Wrong Answer

Solution code:
import sys

def main():
  input = sys.stdin.readline
  S = str(input().strip())
  T = str(input().strip())
  
  C1, C2 = [], []
  ans = 'Yes'
  for c1, c2 in zip(S, T):
    if c1 == c2:
      if (c1 not in C2):
        C1.append(c1)
        C2.append(c2)
        continue
      else:
        ans = 'No'
        break
    else:
      if (c1 in C1) and (c2 in C2):
        continue
      elif (c1 not in C1) and (c2 not in C2):
        C1.append(c1)
        C2.append(c2)
        continue
      else:
        ans = 'No'
        break  
  print(ans)


if __name__ == '__main__':
  main()

Submission status: Wrong Answer

Solution code:
import sys

def main():
  input = sys.stdin.readline
  S = str(input().strip())
  T = str(input().strip())
  
  C1, C2 = [], []
  ans = 'Yes'
  for c1, c2 in zip(S, T):
    if c1 == c2:
      C1.append(c1)
      C2.append(c2)
      continue
    else:
      if (c1 in C1) and (c2 in C2):
        continue
      elif (c1 not in C1) and (c2 not in C2):
        C1.append(c1)
        C2.append(c2)
        continue
      else:
        ans = 'No'
        break  
  print(ans)


if __name__ == '__main__':
  main()

Submission status: Wrong Answer

Solution code:
import sys

def main():
  input = sys.stdin.readline
  S = str(input().strip())
  T = str(input().strip())
  
  C1, C2 = [], []
  ans = 'Yes'
  for c1, c2 in zip(S, T):
    if c1 == c2:
      C1.append(c2)
      continue
    else:
      if (c1 in C1) and (c2 in C2):
        continue
      elif (c1 not in C1) and (c2 not in C2):
        C1.append(c1)
        C2.append(c2)
        continue
      else:
        ans = 'No'
        break  
  print(ans)


if __name__ == '__main__':
  main()

Submission status: Wrong Answer

Solution code:
import sys

def main():
  input = sys.stdin.readline
  S = str(input().strip())
  T = str(input().strip())
  
  C1, C2 = [], []
  ans = 'Yes'
  for c1, c2 in zip(S, T):
    if c1 == c2:
      continue
    else:
      if (c1 in C1) and (c2 in C2):
        C1.append(c2)
        continue
      elif (c1 not in C1) and (c2 not in C2):
        C1.append(c1)
        C2.append(c2)
        continue
      else:
        ans = 'No'
        break  
  print(ans)


if __name__ == '__main__':
  main()

Submission status: Wrong Answer

Solution code:
import sys

def main():
  input = sys.stdin.readline
  S = str(input().strip())
  T = str(input().strip())
  
  C1, C2 = [], []
  ans = 'Yes'
  for c1, c2 in zip(S, T):
    if c1 == c2:
      continue
    else:
      if (c1 in C1) and (c2 in C2):
        C1.append(c1)
        continue
      elif (c1 not in C1) and (c2 not in C2):
        C1.append(c1)
        C2.append(c2)
        continue
      else:
        ans = 'No'
        break  
  print(ans)


if __name__ == '__main__':
  main()

Submission status: Wrong Answer

Solution code:
import sys

def main():
  input = sys.stdin.readline
  S = str(input().strip())
  T = str(input().strip())
  
  C1, C2 = [], []
  ans = 'Yes'
  for c1, c2 in zip(S, T):
    if c1 == c2:
      continue
    else:
      if (c1 in C1) and (c2 in C2):
        continue
      elif (c1 not in C1) and (c2 not in C2):
        C1.append(c1)
        C2.append(c2)
        continue
      else:
        ans = 'No'
        break  
  print(ans)


if __name__ == '__main__':
  main()

Submission status: Wrong Answer

Solution code:
s=input()
t=input()
S=[0 for i in range(26)]
T=[0 for i in range(26)]
for i in range(len(s)):
    S[ord(s[i])-97]=int(str(S[ord(s[i])-97])+str(i))  
for i in range(len(t)):
    T[ord(t[i])-97]=int(str(T[ord(t[i])-97])+str(i))  
ss=sorted(S)
tt=sorted(T)
print(S,T,ss,tt)
if ss==tt:
    print('Yes')
else:print('No')

Submission status: Wrong Answer

Solution code:
s=input()
t=input()
S=[]
T=[]
for i in s:
    S.append(s.count(i)) 
for j in t:
    T.append(t.count(j))
print(S,T)
if S==T:
    print('Yes')
else:print('No')

Submission status: Wrong Answer

Solution code:
s=input()
t=input()
S=[]
T=[]
for i in s:
    S.append(s.count(i)) 
for j in t:
    T.append(t.count(j))
if S==T:
    print('YES')
else:print('NO')

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:

def get_input(inp):
    li = inp.split("\n")

    def inner():
        return li.pop(0)
    return inner

INPUT = """azzel
apple
"""
input = get_input(INPUT)

#######################################################
a = input()
b = input()
k = []
l = []
np=0
nq=0
for i in range(0,len(a)):
    if a[i] not in k:
        k.append(a[i])
        np+=1
    if b[i] not in l:
        l.append(b[i])
        nq+=1
    if i != 0:
        if not (k.index(a[i])==l.index(b[i]) and ((a[i-1]==a[i] and b[i-1] == b[i]) or ( a[i-1] != a[i] and b[i-1]!= b[i]))):
            np*=0
if np == nq:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
a = input()
b = input()
k = []
l = []
np=0
nq=0
for i in range(0,len(a)):
    if a[i] not in k:
        k.append(a[i])
        np+=1
    if b[i] not in l:
        l.append(b[i])
        nq+=1
    if i != 0:
        if not (k.index(a[i])==l.index(b[i]) and (a[i-1]==a[i] and b[i-1] == b[i]) or ( a[i-1] != a[i] and b[i-1]!= b[i])):
            np*=0
if np == nq:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
a = input()
b = input()
k = []
l = []
np=0
nq=0
for i in range(0,len(a)):
    if a[i] not in k:
        k.append(a[i])
        np+=1
    if b[i] not in l:
        l.append(b[i])
        nq+=1
    if i != 0:
        if not ((a[i-1]==a[i] and b[i-1] == b[i]) or ( a[i-1] != a[i] and b[i-1]!= b[i])):
            np*=0
if np == nq:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
a = input()
b = input()
k = []
l = []
np=0
nq=0
for i in range(0,len(a)):
    if a[i] not in k:
        k.append(a[i])
        np+=1
    if b[i] not in l:
        l.append(b[i])
        nq+=1
    if i != 0:
        if not ((a[i-1]==a[i] and b[i-1] == b[i]) or ( a[i-1] != a[i] and b[i-1]!= b[i])):
            np*=-1
if np == nq:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
a = input()
b = input()
k = []
l = []
np=0
nq=0
for i in range(0,len(a)):
    if a[i] not in k:
        k.append(a[i])
        np+=1
    if b[i] not in l:
        l.append(b[i])
        nq+=1
    if i != 0:
        if not ((a[i-1]==a[i] and b[i-1] == b[i]) or ( a[i-1] != a[i] and b[i-1]!= b[i])):
            np+=10
k.sort()
l.sort()
if np == nq:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
a = input()
b = input()
k = []
l = []
np=0
nq=0
for i in range(0,len(a)):
    if a[i] not in k:
        k.append(a[i])
        np+=1
    if b[i] not in l:
        l.append(b[i])
        nq+=1
    if i == 0:
        continue
        if not ((a[i-1]==a[i] and b[i-1] == b[i]) or ( a[i-1] != a[i] and b[i-1]!= b[i])):
            k.append(0)
            np+=10
k.sort()
l.sort()
if np == nq:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
a = input()
b = input()
k = []
l = []
np=0
nq=0
for i in range(0,len(a)):
    if a[i] not in k:
        k.append(a[i])
    if b[i] not in l:
        l.append(b[i])
    if i == 0:
        continue
        if not ((a[i-1]==a[i] and b[i-1] == b[i]) or ( a[i-1] != a[i] and b[i-1]!= b[i])):
            k.append(0)
k.sort()
l.sort()
if k == l:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

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

from collections import defaultdict

td = defaultdict(set)
for i in range(len(s)):
    if s[i] != t[i]:
        td[t[i]].add(s[i])

for key, value in td.items():
    if len(value) >= 2:
        print("No")
        break
else:
    print('Yes')

Submission status: Wrong Answer

Solution code:
dict={
  'a':0,'b':1,'c':2,'d':3,'e':4,'f':5,'g':6,'h':7,'i':8,'j':9,'k':10,'l':11,'m':12,'n':13,'o':14,'p':15,'q':16,'r':17,'s':18,'t':19,'u':20,'v':21,'w':22,'x':23,'y':24,'z':25,
}
l1=['']*26
l2=['']*26
s1=input()
s2=input()
if s1=='azzel':
  exit()
f=0
for i in range(len(s1)):
  a=s1[i]
  b=s2[i]
  ind=dict[a]
  if l1[ind]=='':
    l1[ind]=b
  else:
    if l1[ind]!=b:
      f=1
      break
  ind=dict[b]
  if l2[ind]=='':
    l2[ind]=a
  else:
    if l2[ind]!=a:
      f=1
      break
if f==1:
  print('No')
else:
  print('Yes')

Submission status: Wrong Answer

Solution code:
s1=input()
s2=input()
if s1=='azzel':
  exit()
for i in range(len(s2)):
  a=s1[i]
  b=s2[i]
  s1=s1.replace(a,'#')
  s1=s1.replace(b,'.')
  s1=s1.replace('#',b)
  s1=s1.replace('.',a)
if s1!=s2:
  print('No')
else:
  print('Yes')

Submission status: Wrong Answer

Solution code:
s = input()
t = input()
s = set(s)
t = set(t)

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

Submission status: Wrong Answer

Solution code:
import sys
s=input()
t=input()
for i in range(len(s)):
        if s[i]!=t[i]:
            for ti in t:
                if s[i]==ti:
                    print('No')
                    sys.exit(0)
print('Yes')

Submission status: Wrong Answer

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

diffCache = {}
for s, t in zip(S,T):
    if t in diffCache:
        if s not in diffCache[t]:
            diffCache[t].append(s)
    else:
        diffCache[t] = [s]

for k, v in diffCache.items():
    if len(v) > 1:
        if k in T:
            print('No')
            quit()
print('Yes')

Submission status: Wrong Answer

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

diffCache = {}
for s, t in zip(S,T):
    if t in diffCache:
        if s not in diffCache[t]:
            diffCache[t].append(s)
    else:
        diffCache[t] = [s]

for k, v in diffCache.items():
    if len(v) > 1:
        if len(v) == 2:
            if k == v[0] or k == v[1]:
                continue
        print('No')
        quit()

print('Yes')

Submission status: Wrong Answer

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

diffCache = {}
for s, t in zip(S,T):
    if s != t:
        if t in diffCache:
            if s not in diffCache[t]:
                diffCache[t].append(s)
        else:
            diffCache[t] = [s]

for k, v in diffCache.items():
    if len(v) > 1:
        print('No')
        quit()

print('Yes')

Submission status: Wrong Answer

Solution code:
#!/mnt/c/Users/moiki/bash/env/bin/python
S = input()
T = input()
n = len(T)
from collections import defaultdict

diff_s_to_t = {}
diff_t_to_s = {}

same = set()

for i in range(n):
    if S[i] == T[i]:
        same.add(S[i])

for i in range(n):
    if S[i] != T[i] and not S[i] in diff_s_to_t:
        diff_s_to_t[S[i]] = T[i]
        diff_t_to_s[T[i]] = S[i] 

for i in range(n):
    if S[i] != T[i] and  S[i] in diff_s_to_t:
        if diff_s_to_t[S[i]] != T[i]: # atesaki tigau
            print("No")
            exit(0)


for i in range(n):
    if S[i]==T[i] and S[i] in diff_t_to_s: # same and diff
        print("No")
        exit(0)

    # if S[i] != T[i] and S[i] in same:
    #     # if diff_s_to_t[S[i]] != T[i]: # atesaki tigau
    #     print("No")
    #     exit(0)

print("Yes")
exit(0)

Submission status: Wrong Answer

Solution code:
#!/mnt/c/Users/moiki/bash/env/bin/python
S = input()
T = input()
n = len(T)
from collections import defaultdict

diff_s_to_t = {}
diff_t_to_s = {}

for i in range(n):

    # if S[i] != T[i] and S[i] in diff_s_to_t:
    #     if diff_s_to_t[S[i]] != T[i]: # atesaki tigau
    #         print("No")
    #         exit(0)

    if S[i] != T[i] and not S[i] in diff_s_to_t:
        diff_s_to_t[S[i]] = T[i]
        diff_t_to_s[T[i]] = S[i] # kokoga yokunai?


for i in range(n):
    if S[i]==T[i] and S[i] in diff_t_to_s: # d == d naosenai pattern
        print("No")
        exit(0)
    if S[i] != T[i] and S[i] in diff_s_to_t:
        if diff_s_to_t[S[i]] != T[i]: # atesaki tigau
            print("No")
            exit(0)

print("Yes")
exit(0)

Submission status: Wrong Answer

Solution code:
#!/mnt/c/Users/moiki/bash/env/bin/python
S = input()
T = input()
n = len(T)
from collections import defaultdict

diff_s_to_t = {}
diff_t_to_s = {}

for i in range(n):

    if S[i] != T[i] and S[i] in diff_s_to_t:
        if diff_s_to_t[S[i]] != T[i]: # atesaki tigau
            print("No")
            exit(0)

    elif S[i] != T[i] and not S[i] in diff_s_to_t:
        diff_s_to_t[S[i]] = T[i]
        diff_t_to_s[T[i]] = S[i] # kokoga yokunai?


for i in range(n):
    if S[i]==T[i] and S[i] in diff_t_to_s: # d == d naosenai pattern
        print("No")
        exit(0)

print("Yes")
exit(0)

Submission status: Wrong Answer

Solution code:
#!/mnt/c/Users/moiki/bash/env/bin/python
S = input()
T = input()
n = len(T)
from collections import defaultdict

diff_s_to_t = {}
diff_t_to_s = {}

for i in range(n):

    if S[i] != T[i] and S[i] in diff_s_to_t:
        if diff_s_to_t[S[i]] != T[i]: # atesaki tigau
            print("No")
            exit(0)

    elif S[i] != T[i] and not S[i] in diff_s_to_t:
        diff_s_to_t[S[i]] = T[i]
        diff_t_to_s[T[i]] = S[i] # kokoga yokunai?


    elif S[i]==T[i] and S[i] in diff_t_to_s: # d == d naosenai pattern
        print("No")
        exit(0)

print("Yes")
exit(0)

Submission status: Wrong Answer

Solution code:
#!/mnt/c/Users/moiki/bash/env/bin/python
S = input()
T = input()
from collections import defaultdict

# diff = set()
diff = {}
diff2 = {}
for i,s in enumerate(S):
    if s != T[i] and not s in diff:
        # diff .add ( (s,T[i]) )
        diff[s] = T[i]
        diff2[T[i]] = s
        # diff2[T[i]] = s
    elif s!=T[i] and s in diff:
        if diff[s] != T[i]:
            print("No")
            exit(0)
    elif s==T[i] and s in diff2:
        print("No")
        exit(0)
print("Yes")
exit(0)

# print(diff)
# print(diff2)

S = list(S)
for i,s in enumerate(S):
    if T[i] in diff2 and T[i]  == s :
        print("No")
        exit(0)

print("Yes")
exit(0)
        # S[i] = diff2[s]

# print(S==T)

S = "".join(S)
print(S)
if not S == T:
    for i,s in enumerate(S):
        if s == T[i]:
            print("No")
            exit(0)
print("Yes")



# print(S)

# print ("Yes" if S  == T else "No")

Submission status: Wrong Answer

Solution code:
#!/mnt/c/Users/moiki/bash/env/bin/python
S = input()
T = input()

# diff = set()
diff = {}
diff2 = {}
for i,s in enumerate(S):
    if s != T[i]:
        # diff .add ( (s,T[i]) )
        diff[s] = T[i]
        diff2[T[i]] = s

# print(diff)
# print(diff2)

S = list(S)
for i,s in enumerate(S):
    if T[i] in diff2 and T[i]  == s :
        print("No")
        exit(0)

print("Yes")
exit(0)
        # S[i] = diff2[s]

# print(S==T)

S = "".join(S)
print(S)
if not S == T:
    for i,s in enumerate(S):
        if s == T[i]:
            print("No")
            exit(0)
print("Yes")



# print(S)

# print ("Yes" if S  == T else "No")

Submission status: Wrong Answer

Solution code:
#!/mnt/c/Users/moiki/bash/env/bin/python
S = input()
T = input()

diff = set()
diff2 = {}
for i,s in enumerate(S):
    if s != T[i]:
        # diff .add ( (s,T[i]) )
        diff2[s] = T[i]
        diff2[T[i]] = s

# print(diff)
# print(diff2)

S = list(S)
for i,s in enumerate(S):
    if s in diff2 and s == T[i]:
        print("No")
        exit(0)

print("Yes")
exit(0)
        # S[i] = diff2[s]

# print(S==T)

S = "".join(S)
print(S)
if not S == T:
    for i,s in enumerate(S):
        if s == T[i]:
            print("No")
            exit(0)
print("Yes")



# print(S)

# print ("Yes" if S  == T else "No")

Submission status: Wrong Answer

Solution code:
a = raw_input()
b = raw_input()

l = len(a)
if a == b:
    print "Yes"
else:
    state = 0
    for i in range(l-1):
        a = a[-1]+a[0:-1]
        if a == b:
            print "Yes"
            state = 1
            break
    if state == 0:
        print "No"

Submission status: Wrong Answer

Solution code:
S = raw_input()
T = raw_input()

sz = len(S)
S += S

for i in range(sz):
    if S[i : i + sz] == T:
        print "Yes"
        exit()

print "No"

Submission status: Wrong Answer

Solution code:
s = input()
t = input()
l = len(s)
mydict = {}
totalflag = True
alphabetlist = ["a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z"]
for i in range(l):
    if (i in mydict.keys()) == True:
        totalflag == False
    else:
        mydict[s[i]] = t[i]

if totalflag == True:
    for x in alphabetlist:
        flag = False
        chainsent = []
        chainsent.append(x)
        if (x in mydict.keys()) == True:
            y = mydict[x]
            while True:
                # print(x)
                # print(chainsent)
                # print(y)
                if y in chainsent:
                    if y == x or y == "*":
                        # print("True:",y)
                        flag = True
                    else:
                        # print("False:",y)
                        flag = False
                    break
                else:
                    chainsent.append(y)
                    if (y in mydict.keys()) == True:
                        # print("append:",y)
                        y = mydict[y]
                    else:
                        # print("astarisk:",y)
                        mydict[y] = "*"
                        flag = True
                        break
        else:
            y = "*"
            flag = True
        if flag == False:
            totalflag = False
            break
    if totalflag == True:
        print("Yes")
    else:
        print("No")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
s = input()
t = input()
l = len(s)
mydict = {}
alphabetlist = ["a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z"]
for i in range(l):
    mydict[s[i]] = t[i]
totalflag = True
for x in alphabetlist:
    flag = False
    chainsent = []
    chainsent.append(x)
    if (x in mydict.keys()) == True:
        y = mydict[x]
        while True:
            # print(x)
            # print(chainsent)
            # print(y)
            if y in chainsent:
                if y == x or y == "*":
                    # print("True:",y)
                    flag = True
                else:
                    # print("False:",y)
                    flag = False
                break
            else:
                chainsent.append(y)
                if (y in mydict.keys()) == True:
                    # print("append:",y)
                    y = mydict[y]
                else:
                    # print("astarisk:",y)
                    mydict[y] = "*"
                    flag = True
                    break
    else:
        y = "*"
        flag = True
    if flag == False:
        totalflag = False
        break
if totalflag == True:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
s=input()
t=input()
sl=list(s)
tl=list(t)
if len(set(sl))!=len(set(tl)):
    ans="No"
else:
    ans="Yes"
print(ans)

Submission status: Wrong Answer

Solution code:
S = list(raw_input())
T = list(raw_input())

S.sort()
T.sort()
Sdata = []
Tdata = []

counter = 0
p = S[0]
for i in S:
    if i == p:
        counter += 1
    else:
        Sdata.append(counter)
        counter = 1
        p = i
Sdata.append(counter)

counter = 0
p = S[0]
for i in T:
    if i == p:
        counter += 1
    else:
        Tdata.append(counter)
        counter = 1
        p = i
Tdata.append(counter)

Sdata.sort()
Tdata.sort()

if Sdata == Tdata:
    print 'Yes'
else:
    print 'No'

Submission status: Wrong Answer

Solution code:
S = list(raw_input())
T = list(raw_input())

S.sort()
T.sort()
Sdata = []
Tdata = []

counter = 0
p = S[0]
for i in S:
    if i == p:
        counter += 1
    else:
        Sdata.append(counter)
        counter = 1
        p = i
Sdata.append(counter)

counter = 0
p = S[0]
for i in T:
    if i == p:
        counter += 1
    else:
        Tdata.append(counter)
        counter = 1
        p = i
Tdata.append(counter)

Sdata.sort()
Tdata.sort()

if Sdata == Tdata:
    print 'YES'
else:
    print 'NO'

Submission status: Wrong Answer

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

mapping = {}
for i in range(len(s)):
    if s[i] in mapping:
        if mapping[s[i]] == t[i]:
            continue
        else:
            print('No')
            break
    else:
        mapping[s[i]] = t[i]
else:
    print('Yes')

Submission status: Wrong Answer

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

for i in range(len(s)):
    if s[i] != t[i]:
        be = s[i]
        af = t[i]
        for j in range(i, len(s)):
            if s[j] == be:
                s[j] = af
            elif s[j] == af:
                s[j] = be
    #print(s)

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

Submission status: Wrong Answer

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

for i in range(len(s)):
    if s[i] != t[i]:
        be = s[i]
        af = t[i]
        for i in range(i, len(s)):
            if s[i] == be:
                s[i] = af
            elif s[i] == af:
                s[i] = be

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

Submission status: Wrong Answer

Solution code:
import collections
s = input()
t = input()

d = {}
flag = True
for i in range(len(s)):
    if s[i] in d.keys():
        if t[i] == d[s[i]]:
            continue
        else:
            flag=False
            break
    elif t[i] in d.keys():
        if s[i] == d[t[i]]:
            continue
        else:
            flag=False
            break
    else:
        d[s[i]] = t[i]
        d[t[i]] = s[i]

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

Submission status: Wrong Answer

Solution code:
import collections
s = input()
t = input()

d = {}
flag = True
for i in range(len(s)):
    if s[i] in d.keys():
        if t[i] == d[s[i]]:
            continue
        else:
            flag=False
            break
    else:
        d[s[i]] = t[i]

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

Submission status: Wrong Answer

Solution code:
import collections
s = input()
t = input()

d = {}
flag = True
for i in range(len(s)):
    if s[i] in d.keys():
        if t[i] == d[s[i]]:
            continue
        else:
            flag=False
            break
    else:
        if t[i] == s[i]:
            continue
        else:
            d[s[i]] = t[i]

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

Submission status: Wrong Answer

Solution code:
import collections
s = input()
t = input()

d = {}
flag = True
for i in range(len(s)):
    if t[i] in d.keys():
        if s[i] == d[t[i]]:
            continue
        else:
            flag=False
            break
    else:
        if s[i] == t[i]:
            continue
        else:
            d[t[i]] = s[i]

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

Submission status: Wrong Answer

Solution code:
import collections
s = input()
t = input()

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

# print(list(cs.values()),list(ct.values()))
if(list(cs.values())==list(ct.values())):
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
import collections
s = input()
t = input()

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

# print(list(cs.values()),list(ct.values()))
if(list(cs.values())==list(ct.values())):
    print("YES")
else:
    print("NO")