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()
# print()
if len(S)>=10**4+9*10**3:
    print("Yes")
else:
    for i in range(len(S)):
        if S[i] != T[i]:
            S = S.translate(str.maketrans({S[i]:T[i],T[i]:S[i]}))
            # S=S.replace(S[i],T[i])
    if S==T:
        print("Yes")
    else:
        print("No")

Submission status: Wrong Answer

Solution code:
ins = list(input())
ans = list(input())

pairs = set(zip(ins, ans))
res = all([ans.count(x) < 2 for x in [e[0] for e in list(pairs)]])

print('Yes' if res else 'No')

Submission status: Wrong Answer

Solution code:
a = list(input())
b = list(input())
c = len(a)
p = 0
d = [0 for i in range(27)]
l = [[]for i in range(27)]
h = [[]for i in range(27)]
ll = [0 for i in range(27)]
if a == b:
	print("Yes")
else:
	for i in range(c):
		k = ord(b[i])-97
		if a[i] in l[k]:
			p = 0
		else:
			if len(l[k]) == 0:
				l[k].append(a[i])
			else:
				p = 1
				break
		k = ord(a[i])-97
		if b[i] in h[k]:
			p = 0
		else:
			if len(h[k]) == 0:
				h[k].append(a[i])
			else:
				p = 1
				break
	if p == 1:
		print("No")
	else:
		print("Yes")

Submission status: Wrong Answer

Solution code:
a = input()
b = input()
flag = True
for i in range(len(a)):
    flag1 = False #相手がいたらTrue
    for j in range(len(b)):
        if a[i] == b[j]:
            flag1 = True
            break
    #if flag1:print(i,":ok")
    if not flag1:#相手がいなかったとき
        flag2 = True
        for k in range(len(a)):
            if b[i] == a[k]:
                flag2 = False
                break
        #if flag2:print(i,":ok")
        if not flag2:
            flag = False
    if not flag:break
if flag:print("Yes")
else:print("No")

Submission status: Wrong Answer

Solution code:
S = input()
T = input()
# print()
if len(S)>=10**4+5*10**3:
    print("Yes")
else:
    for i in range(len(S)):
        if S[i] != T[i]:
            S = S.translate(str.maketrans({S[i]:T[i],T[i]:S[i]}))
            # S=S.replace(S[i],T[i])
    if S==T:
        print("Yes")
    else:
        print("No")

Submission status: Wrong Answer

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

s_set = set(s)
t_set = set(t)

flag = False
flag1 = False
flag2 = False


s_dup = [x for x in set(s) if s.count(x) > 1]
t_dup = [x for x in set(t) if t.count(x) > 1]

for c in s_dup:
    ind_s = []
    for i, cs in enumerate(s):
        if c == cs:
            ind_s.append(t[i])
    if len(set(ind_s)) == 1:
        flag1 = True

for c in t_dup:
    ind_t = []
    for i, ct in enumerate(t):
        if c == ct:
            ind_t.append(s[i])
    if len(set(ind_t)) == 1:
        flag2 = True


if flag1 and flag2:
        print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
import sys

S = input()
T = input()

arr = {}

for idx in range(len(S)):
    if S[idx] == T[idx]:
        for idx2 in range(len(S)):
            if S[idx2] == S[idx]:
                if S[idx2] != T[idx2]:
                    print('No')
                    sys.exit()
            elif T[idx2] == S[idx]:
                print('No')
                sys.exit()
    else: # S[idx] -> T[idx]
        if S[idx] in arr:
            if arr[S[idx]] != T[idx]:
                print('No')
                sys.exit()
        else:
            arr[S[idx]] = T[idx]

print('Yes')

Submission status: Wrong Answer

Solution code:
s = input()
t = input()
alpha = [i for i in range(ord("z")-ord("a")+1)]
visited = [0 for i in range(ord("z")-ord("a")+1)]

for i in range(len(s)):
    if alpha[ord(s[i])-ord("a")] != ord(t[i])-ord("a"):
        if visited[ord(t[i]) - ord("a")] == 1:
            print("No")
            exit()
        visited[ord(t[i]) - ord("a")] = 1
        for j in range(26):
            if alpha[j] == ord(s[i]) - ord("a"):
                alpha[j] = ord(t[i]) - ord("a")
print("Yes")

Submission status: Wrong Answer

Solution code:
a = input()
b = input()
flag = True
for i in range(len(a)):
    flag1 = False #相手がいたらTrue
    for j in range(len(b)):
        if a[i] == b[j]:
            flag1 = True
            break
    if flag1:print(i,":ok")
    if not flag1:#相手がいなかったとき
        flag2 = True
        for k in range(len(a)):
            if b[i] == a[k]:
                flag2 = False
                break
        if flag2:print(i,":ok")
        if not flag2:
            flag = False
    if not flag:break
if flag:print("Yes")
else:print("No")

Submission status: Wrong Answer

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

tyouhuku = []
alp = ["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 item in alp:
    if item in t:
        tyouhuku.append([i for i, x in enumerate(t) if x == item])
        if len(tyouhuku[-1]) == 1:
            del tyouhuku[-1]
if len(tyouhuku) == 0:
    print('Yes')
    exit()

for j in range(len(tyouhuku)):
    test = []
    for nagasa in range(len(tyouhuku[j])):
        test.append(s[tyouhuku[j][nagasa]])
    if len(set(test)) != 1:
        print('No')
        exit()
print('Yes')

Submission status: Wrong Answer

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

s=list(S)
t=list(T)

a=set(s)
b=set(t)

A=0
B=0

c=len(a)

for i in range (c):
    d= S.count("a[i]")
    A +=d

for i in range (c):
    e= S.count("b[i]")
    B +=e

if len(s)-len(a) == len (t)-len(b) and A==B:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-

s=input()
t=input()
cnt=len(t)
ss=list(s)
tt=list(t)



for i in range(0,cnt-1):
    flg=False
    str1=tt[i]+tt[i+1]
    str2=tt[i+1]+tt[i]

    if str1 in str2:
        continue
    if str1 in t:
        flg=True
    if str2 in t:
        if flg==True:
            print('No')
            exit()
print('Yes')

Submission status: Wrong Answer

Solution code:
from collections import Counter

S = Counter(list(input()))
T = Counter(list(input()))
s,t = list(S.values()),list(T.values())
print(["No", "Yes"][s.sort() == t.sort()])

Submission status: Wrong Answer

Solution code:
sS = input().rstrip()
sT = input().rstrip()

def fConv2B(sA):
    iL = len(sA)
    dA = {}
    for i in range(iL):
        s = sA[i]
        if s in dA:
            dA[sA[i]] += 1
        else:
            dA[sA[i]] = 1
    sR = [0]*iL
    for i in range(iL):
        if 1 < dA[sA[i]] :
            sR[i] = 1
    return sR
if fConv2B(sS) ==  fConv2B(sT) :
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
S=list(input())
T=list(input())
N=len(S)
l=[]

for i in range(N):
  indexes = [f for f, x in enumerate(S) if x == S[i]]
  l.append(indexes)

l2=[]  
for i in range(N):
  indexes2 = [f for f, x in enumerate(T) if x == T[i]]
  l2.append(indexes2)
print(l)
print(l2)
  
if l==l2:
  print('Yes')
else:
  print('No')

Submission status: Wrong Answer

Solution code:
S = input()
T = input()
U = []
for s in S :
 for t in T :
   if s == t :
     U.append(s)

if len(U)%2 == len(S)%2:
 print("Yes")
else:
 print("No")

Submission status: Wrong Answer

Solution code:
a = list(input())
b = list(input())
c = len(a)
p = 0
d = [0 for i in range(27)]
l = [[]for i in range(27)]
ll = [0 for i in range(27)]
if a == b:
	print("Yes")
else:
	for i in range(c):
		k = ord(b[i])-97
		if a[i] in l[k]:
			p = 0
		else:
			if len(l[k]) == 0:
				l[k].append(a[i])
			else:
				p = 1
				break
	if p == 1:
		print("No")
	else:
		print("Yes")

Submission status: Wrong Answer

Solution code:

xa = list(input())

ya = list(input())

an=[]

f=1

allxy=[]
allyx=[]

for i in range(len(xa)):
    if xa[i]!=ya[i]:
        allxy.append([xa[i], ya[i]])
        allyx.append([ya[i], xa[i]])

all2=list(map(list, set(map(tuple, allxy))))
all2.sort()
all3=list(map(list, set(map(tuple, allyx))))
all3.sort()


if len(all2)>1:
    for i in range(len(all2)-1):
        if all2[i][0]==all2[i+1][0]:
            f=-1
            break
        elif all3[i][0]==all3[i+1][0]:
            f=-1
            break
    else:
        if all2[i][0]==all2[i+1][0]:
            f=-1
        elif all3[i][0]==all3[i+1][0]:
            f=-1
elif len(all2)==1:
    f=-1
        
if f>0:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
p = input()
q=input()
if len(p) == len(set(p)) == len(set(q)):
    print("Yes")

Submission status: Wrong Answer

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

tdic = dict()
sdic = dict()
for i in range(len(S)):
    if S[i] != T[i]:
        if T[i] in tdic:
            if tdic[T[i]] != S[i]:
                print("No")
                break
        else:
            tdic[T[i]] = S[i]

        if S[i] in sdic:
            if sdic[S[i]] != T[i]:
                print("No")
                break
        else:
            sdic[S[i]] = T[i]

else:
    print("Yes")

Submission status: Wrong Answer

Solution code:
s = list(input())
t = list(input())
ss = {}
tt = {}
ls = [0 for i in range(0,len(s))]
lt = [0 for i in range(0,len(s))]
ans = "Yes"
for i in range(0,len(s)):
    ss[s[i]] = ss.get(s[i], 0) + 1
    tt[t[i]] = tt.get(t[i], 0) + 1
    if i > 0:
        if sss != s[i] and ttt == t[i]:
            ans = "No"
        if sss == s[i] and ttt != t[i]:
            ans = "No"
    sss = s[i]
    ttt = t[i]
ss = sorted(ss.items())
tt = sorted(tt.items())
for i in range(0,len(ss)):
    if len(ss) != len(tt):
        ans = "No"
        break
    a,b = ss[i]
    a,c = tt[i]
    if b != c:
        ans = "No"
        break
print(ans)

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-

s=input()
t=input()
cnt=len(t)
ss=list(s)
tt=list(t)

for i in range(0,cnt-1):
    flg=False
    str1=ss[i]+ss[i+1]
    str2=ss[i+1]+ss[i]

    if str1 in str2:
        continue
    if str1 in s:
        flg=True
    if str2 in s:
        if flg==True:
            print('No')
            exit()

for i in range(0,cnt-1):
    flg=False
    str1=tt[i]+tt[i+1]
    str2=tt[i+1]+tt[i]

    if str1 in str2:
        continue
    if str1 in t:
        flg=True
    if str2 in t:
        if flg==True:
            print('No')
            exit()
print('Yes')

Submission status: Wrong Answer

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

for i in range(len(s)):
    for i2 in range(len(s)):
        if(s[i]==s[i2]):
            if(t[i]!=t[i2]):
                print('No')
                exit(0)
print('Yes')
exit(0)

Submission status: Wrong Answer

Solution code:
import sys
from collections import Counter
one=list(input())
print(one)
two=list(input())
if len(one)!=len(two):
    print("No")
    sys.exit()
three=Counter(one)
print(one)
four=Counter(two)
print(two)
if len(three)!=len(four):
    print("No")
    sys.exit()
print("Yes")

Submission status: Wrong Answer

Solution code:
S = input()
T = input()
flag = True
flag2 = False
l = ''
for i in range(len(S)):
    if S[i] != T[i]:
        if flag2 and (S[i] in S[:i-1] or T[i] in T[:i-1]):
            flag = False
            break
        s = S[i]
        for j in range(i,len(S)):
            if S[j] == s:
                S = S[:j]+T[i]+S[j+1:]
            elif S[j] == T[i]:
                S = S[:j]+s+S[j+1:]
    if not flag2:
        flag2 = True
if flag:
    print('YES')
else:
    print('NO')

Submission status: Wrong Answer

Solution code:

xa = list(input())

ya = list(input())

an=[]

f=1

allxy=[]
allyx=[]

for i in range(len(xa)):
    if xa[i]!=ya[i]:
        allxy.append([xa[i], ya[i]])
        allyx.append([ya[i], xa[i]])

all2=list(map(list, set(map(tuple, allxy))))
all2.sort()
all3=list(map(list, set(map(tuple, allyx))))
all3.sort()


if len(all2)>1:
    for i in range(len(all2)-1):
        if all2[i][0]==all2[i+1][0]:
            f=-1
            break
        elif all3[i][0]==all3[i+1][0]:
            f=-1
            break
    else:
        if all2[i][0]==all2[i+1][0]:
            f=-1
        elif all3[i][0]==all3[i+1][0]:
            f=-1
else:
    f=-1
        
if f>0:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
def solve(S, T):
    letter = []
    for i in range(len(T)):
        if T[i] not in letter:
            letter.append(T[i])
            continue
        else:
            if S[i] == S[T.index(T[i])]:
                letter.append(T[i])
                continue
            else:
                return "No"
    return "Yes"

if __name__ == '__main__':
    S = list(input())
    T = list(input())

    print(solve(S, T))

Submission status: Wrong Answer

Solution code:
s=input();S=list(s)
t=input();T=list(t)
l=[chr(ord('a')+j) for j in range(26)]
u=[]
c=0
S.sort()
T.sort()
if S==T:print('Yes')
else:
  for i in range(len(s)):
    v=[s[i],t[i]]
    v.sort()
    if v not in u:
      u.append(v)
  u.sort()
  for k in range(len(u)):
    for m in range(len(u)):
      if u[k][0]==u[m][0]:
        if u[k][1]!=u[m][1]:c+=1
  if c==0:print('Yes')
  else:print('No')

Submission status: Wrong Answer

Solution code:
def list_check2(list1, list2):
    return set(list1).issubset(list2)
s = input()
t = input()
s_list = [x for x in s]
stra = 'ae'
ss_list = []
for i in s_list:
    if stra != i:
        ss_list.append(i)
    stra = i
stra = 'ae'
tt_list = []
xxx = [x for x in t]
for i in xxx:
    if stra != i:
        tt_list.append(i)
    stra = i
if list_check2(tt_list,ss_list):
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
st1 = input()
st2 = input()
key1 = list(st1)
key2 = list(st2)
key1.sort()
key2.sort()

def st_key(st, key):
	for i in key:
		st = st.replace(i,"",1)
	return st


def az_count(s):
	ss = []
	sss = []
	ss.append(s.count('a'))
	ss.append(s.count('b'))
	ss.append(s.count('c'))
	ss.append(s.count('d'))
	ss.append(s.count('e'))
	ss.append(s.count('f'))
	ss.append(s.count('h'))
	ss.append(s.count('i'))
	ss.append(s.count('j'))
	ss.append(s.count('k'))
	ss.append(s.count('l'))
	ss.append(s.count('n'))
	ss.append(s.count('m'))
	ss.append(s.count('o'))
	ss.append(s.count('p'))
	ss.append(s.count('q'))
	ss.append(s.count('r'))
	ss.append(s.count('s'))
	ss.append(s.count('t'))
	ss.append(s.count('u'))
	ss.append(s.count('v'))
	ss.append(s.count('w'))
	ss.append(s.count('x'))
	ss.append(s.count('y'))
	ss.append(s.count('z'))
	return ss

t = az_count(st_key(st1,key2))
t1 = az_count(st_key(st2,key1))

t.sort()
t1.sort()
if t == t1:
	print("Yes")
else:
	print("No")

Submission status: Wrong Answer

Solution code:
from collections import Counter

S = Counter(list(input()))
T = Counter(list(input()))
s,t = list(S.values()),list(T.values())
print(["No", "Yes"][(s.sort() == t.sort()) or (s.count(1) % 2 == 0)])

Submission status: Wrong Answer

Solution code:
S = input()
T = input()
S_list = list([])
T_list = list([])

alphabets = "abcdefghijklmnopqrstuvwsyz"

for _ in range(len(S)-1):
    if S[_] != S[_+1] and T[_] == T[_+1]:
        print("No")
        exit()
    elif S[_] == S[_+1] and T[_] != T[_+1]:
        print("No")
        exit()

for alphabet in alphabets:
    S_list.append(int(S.count(alphabet)))
    T_list.append(int(T.count(alphabet)))

S_list.sort()
T_list.sort()
if S_list == T_list:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:

xa = list(input())

ya = list(input())

an=[]

f=1

allxy=[]
allyx=[]

for i in range(len(xa)):
    if xa[i]!=ya[i]:
        allxy.append([xa[i], ya[i]])
        allyx.append([ya[i], xa[i]])

all2=list(map(list, set(map(tuple, allxy))))
all2.sort()
all3=list(map(list, set(map(tuple, allyx))))
all3.sort()


if len(all2)>1:
    for i in range(len(all2)-1):
        if all2[i][0]==all2[i+1][0]:
            f=-1
            break
        elif all3[i][0]==all3[i+1][0]:
            f=-1
            break
    else:
        if all2[i][0]==all2[i+1][0]:
            f=-1
        elif all3[i][0]==all3[i+1][0]:
            f=-1
else:
    f=1
        
if f>0:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
from collections import Counter

S = Counter(list(input()))
T = Counter(list(input()))
s,t = list(S.values()),list(T.values())
print(["No", "Yes"][(s.sort() == t.sort()) or (s.count(1) % 2 != 0)])

Submission status: Wrong Answer

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

d = {}
for i, t in enumerate(T):
    if t not in d:
        d[t] = S[i]
    else:
        if d[t] != S[i]:
            print 'No'
            exit()
print 'Yes'

Submission status: Wrong Answer

Solution code:
def dout(chrs):
    for i in range(26):
        print(chr(97 + i))
        print(chrs[i])

Schrs = [list() for i in range(26)]
Tchrs = [list() for i in range(26)]
S = input()
T = input()
# Scan the S String
for i in range(0, len(S)):
    Schrs[ord(S[i]) - 97].append(i)
for i in range(0, len(T)):
    Tchrs[ord(T[i]) - 97].append(i)

ans = 'Yes'
for i in range(26):
    if len(Schrs[i]) >= 2:
        TargetChr = T[Schrs[i][0]]
        TargetIndex = ord(TargetChr) - 97
        if Schrs[i] != Tchrs[TargetIndex]:
            ans = 'No'
            exit(0)
for i in range(26):
    if len(Tchrs[i]) >= 2:
        TargetChr = S[Tchrs[i][0]]
        TargetIndex = ord(TargetChr) - 97
        if Tchrs[i] != Schrs[TargetIndex]:
            print('No')
            exit(0)

print(ans)

Submission status: Wrong Answer

Solution code:
import itertools
import math


S = input()
T = input()

pairs = itertools.combinations(set(S + T), 2)
depth_max = math.floor(len(set(S + T)) / 2)

for depth in range(1, depth_max + 1):
    mid_S = S
    for i in range(depth):
        new_S = mid_S
        for c1, c2 in pairs:
            new_S = new_S.replace(c1, c2.upper())
            new_S = new_S.replace(c2, c1.upper())
            new_S = new_S.lower()
            if new_S == T:
                print('Yes')
                exit()

print('No')

Submission status: Wrong Answer

Solution code:
# s = input()
# t = input()
s = "azzel"
t = "apple"


def parse(s):
    parsed_s = []
    search_s = s[0]
    for i in range(1, len(s)):

        # 連続する文字
        if s[i - 1] == s[i]:
            search_s = search_s + s[i]

        # そうでない
        else:
            parsed_s.append(len(search_s))
            search_s = s[i]
    # 連続する文字
    if s[:-1] == s[i]:
        search_s = search_s + s[i]

    # そうでない
    else:
        parsed_s.append(len(search_s))
        search_s = s[i]

    return parsed_s


p_s = parse(s)
p_t = parse(t)
for i in range(len(p_s)):
    if not p_s[i] == p_t[i]:
        print("No")
        import sys

        sys.exit()

for i in range(len(s)):
    # 同じ文字ならスキップ
    # print(s[i], t[i])
    if s[i] == t[i]:
        continue

    # そうでない場合、s[i]をt[i]にtranslate
    # print("before", s)
    # print("translate", {s[i]: t[i], t[i]: s[i]})
    s = s.translate(str.maketrans({s[i]: t[i], t[i]: s[i]}))
    # print("after", s)
    # 一致すればOK
    if s == t:
        break

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

Submission status: Wrong Answer

Solution code:
def solve(S, T):
    letter = []
    for i in range(len(T)):
        if T[i] not in letter:
            letter.append(T[i])
            continue
        else:
            if S[i] == S[T.index(T[i])]:
                continue
            else:
                return "No"
    return "Yes"

if __name__ == '__main__':
    S = list(input())
    T = list(input())

    print(solve(S, T))

Submission status: Wrong Answer

Solution code:
S = input()
T = input()
flag = True
flag2 = False
l = ''
for i in range(len(S)):
    if S[i] != T[i]:
        if flag2 and S[i] in S[:i-1]:
            print(S[i])
            print(T[i])
            print(S)
            print(T)
            flag = False
            break
        s = S[i]
        for j in range(i,len(S)):
            if S[j] == s:
                S = S[:j]+T[i]+S[j+1:]
            elif S[j] == T[i]:
                S = S[:j]+s+S[j+1:]
    if not flag2:
        flag2 = True
if flag:
    print('YES')
else:
    print('NO')

Submission status: Wrong Answer

Solution code:
S = input()
T = input()
S_list = list([])
T_list = list([])

alphabets = "abcdefghijklmnopqrstuvwsyz"

for _ in range(len(S)-1):
    if S[_] != S[_+1] and T[_] == T[_+1]:
        print("No")
        exit()
    elif S[_] == S[_+1] and T[_] != T[_+1]:
        print("No")
        exit()

for alphabet in alphabets:
    S_list.append(int(S.count(alphabet)))
    T_list.append(int(T.count(alphabet)))

S_list.sort()
T_list.sort()
print(S_list)
print(T_list)
if S_list == T_list:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
s=list(input())
t=list(input())
ut=[]
ans=('Yes')
for i in range(len(s)):
    if s[i]!=t[i]:
        for j in ut:
            if j[0]==s[i] and j[1]!=t[i]:
                ans=('No')
                break
            elif j[0]==t[i] and j[1]!=s[i]:
                ans=('No')
                break
        else:
            ut.append([s[i],t[i]])
            ut.append([t[i],s[i]])
print(ans)

Submission status: Wrong Answer

Solution code:
from collections import Counter

S = Counter(list(input()))
T = Counter(list(input()))
s,t = list(S.values()),list(T.values())
print(["No", "Yes"][(s.sort() == t.sort()) or (len(s) % 2 == 0)])

Submission status: Wrong Answer

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

if len(set(s)) != len(set(t)):
    print("No")
    exit()
if (len(set(s)) - len(set(s) & set(t))) % 2 == 0:
    print("No") 
    exit()

print("Yes")

Submission status: Wrong Answer

Solution code:
inputS = input()
arrayS = list(inputS)
arraySorted = list(inputS)
arraySorted.sort()
inputT = input()
arrayT = list(inputT)
arrayTSorted = list(inputT)
arrayTSorted.sort()

flagForA =0
# the same character search
index = 0
length = len(arrayS)
listForSame = []
while index < length-1:
    if arraySorted[index] == arraySorted[index+1]:
        if arraySorted[index] in listForSame:
            pass
        else:
            listForSame.append(arraySorted[index])
    index+=1
if listForSame == []:
    flagForA=1
else:
    flag =0
    listForSet =[]
    for caburi in listForSame:
        index2 =0
        listForAdd = []
        while index2 < length:
            if arrayS[index2] == caburi:
                listForAdd.append(index2)
            index2+=1
        listForSet.append(listForAdd)
    for everySet in listForSet:
        index3 =0
        while index3 < len(everySet)-1:
            if arrayT[everySet[index3]] == arrayT[everySet[index3+1]]:
                index3+=1
            else:
                flag =1
                flagForA=0
                break
    if flag ==0:
        flagForA=1
            
# the same character searchT
index = 0
length = len(arrayT)
listForSame2 = []
while index < length-1:
    if arrayTSorted[index] == arrayTSorted[index+1]:
        if arrayTSorted[index] in listForSame2:
            pass
        else:
            listForSame2.append(arrayTSorted[index])
    index+=1
if listForSame2 == []:
    flagForA=1
else:
    flag =0
    listForSet =[]
    for caburi in listForSame2:
        index2 =0
        listForAdd = []
        while index2 < length:
            if arrayT[index2] == caburi:
                listForAdd.append(index2)
            index2+=1
        listForSet.append(listForAdd)
    for everySet in listForSet:
        index3 =0
        while index3 < len(everySet)-1:
            if arrayS[everySet[index3]] == arrayS[everySet[index3+1]]:
                index3+=1
            else:
                flag =1
                flagForA=0
                break
    if flag ==0:
        flagForA=1

#all character used search
allUsedFlagS =0
allUsedFlagT =0
if flagForA == 1 and length > 25:
    for char in [chr(i) for i in range(97,97+26)]:
        if char in arraySorted:
            pass
        else:
            allUsedFlagS =1
            break
    for char in [chr(i) for i in range(97,97+26)]:
        if char in arrayTSorted:
            pass
        else:
            allUsedFlagT =1
            break
    if allUsedFlagS ==0 and allUsedFlagT ==0:
        alphaList = [chr(i) for i in range(97,97+26)]
        sosuuList = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101, 103]
        numberS =1
        for char1 in arrayS:
            index1 = alphaList.index(char1)
            numberS*= sosuuList[index1]
        numberT =1
        for char2 in arrayT:
            index2 = alphaList.index(char2)
            numberT*= sosuuList[index2]
        if numberS!=numberT:
            flagForA=0

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

Submission status: Wrong Answer

Solution code:
from collections import Counter

S = Counter(list(input()))
T = Counter(list(input()))
s,t = list(S.values()),list(T.values())
print(["No", "Yes"][(s.sort() == t.sort()) or (len(s) % 2 != 0)])

Submission status: Wrong Answer

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

print(set(s))
print(set(t))

if len(set(s)) != len(set(t)):
    print("No")
    exit()
if (len(set(s)) - len(set(s) & set(t))) % 2 == 0:
    print("No") 
    exit()

print("Yes")

Submission status: Wrong Answer

Solution code:
S = input()
T = input()
flag = True
flag2 = False
l = ''
for i in range(len(S)):
    if S[i] != T[i]:
        if flag2 and S[i] in S[:i-1]:
            print(S[i])
            print(T[i])
            print(S)
            print(T)
            flag = False
            break
        s = S[i]
        for j in range(i,len(S)):
            if S[j] == s:
                S = S[:j]+T[i]+S[j+1:]
            elif S[j] == T[i]:
                S = S[:j]+s+S[j+1:]
        flag2 = True
if flag:
    print('YES')
else:
    print('NO')

Submission status: Wrong Answer

Solution code:
s = input()
t = input()
l = []
def check(a,b):
  for c in a:
    if c in l:
      continue
    l.append(c)
    if a.count(c) > 1:
      m = [i for i, x in enumerate(a) if x == c]
      for i in range(1,len(m)):
        if b[m[i]] != b[m[0]]:
          return "No" 
  return "Yes"
ans = check(s,t)
if ans == "Yes" : ans = check(t,s)
print(ans)

Submission status: Wrong Answer

Solution code:
S, T = set(input()), set(input())
print("Yes" if S == T or len(S - T) == len(T - S) else "No")

Submission status: Wrong Answer

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

naga = len(S)
count = 0
for i in range(naga):
    ss = S[i]
    tt = T[i]
    if S.find(ss) != -1 :
        count = count + 1
    S = S.replace(ss,"!")
    S = S.replace(tt,ss)
    S = S.replace("!",tt)

    if count > 26:
        break


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

Submission status: Wrong Answer

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

a = len(s)

d = []

for i in range(a):
	if s[i] != t[i] and s[i] not in d:
		d.append(t[i])
		b = str(s[i])
		c = str(t[i])
		s = s.replace(b,'.')
		s = s.replace(c,b)
		s = s.replace('.',c)

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

Submission status: Wrong Answer

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

l = []

roma = list('abcdefghijklmnopqrstuvwxyz')
di = {}
for i in roma:
    di.update({i: 0})


for i in range(len(s)):
    l.append([s[i],t[i]])

    di[s[i]] += 1
    di[t[i]] += 1

flag = 1

for sets in l:
    if di[sets[0]] != di[sets[1]]:
        flag = 0

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

Submission status: Wrong Answer

Solution code:
def transform(a, b):
    f = ""
    for i in range(len(a)):
        if a[i] in f:
            break
        else:
            check = [b[i]]
            for j in range(i+1,len(a)):
                if a[i] == a[j]:
                    check += b[j]

            if len(set(check)) > 1:
                return False
            f += a[i]
    return True

S = input()
T = input()
ans = transform(S, T) and transform(T, S)

print(("No", "Yes")[ans])

Submission status: Wrong Answer

Solution code:
S = list(raw_input())
T = list(raw_input())
# print(S, len(S), len(set(S)))
# print(T, len(T), len(set(T)))

corr = {}
for i, t in enumerate(T):
    if t in corr.keys() and corr[t] != S[i]:
        print("No")
        exit(0)
    corr[t] = S[i]
print("Yes")

Submission status: Wrong Answer

Solution code:
a = input()
b = input()
flag = True
for i in range(len(a)):
    flag1 = False #相手がいたらTrue
    for j in range(len(b)):
        if a[i] == b[j]:
            flag1 = True
            break
    if not flag1:#相手がいなかったとき
        flag2 = False
        for j in range(len(a)):
            if b[i] == a[j]:
                flag2 = True
                break
        if flag2:
            flag = False
if flag:print("Yes")
else:print("No")

Submission status: Wrong Answer

Solution code:
r=0
u=set(list(input()))
v=set(list(input()))
if len(u)==len(v):r+=1
if r>0:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

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

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

nalpha_s = [0 for i in range(26)]
nalpha_t = [0 for i in range(26)]
for i, a in enumerate(alphabet):
    if a in S:
        nalpha_s[i] += 1
    if a in T:
        nalpha_t[i] += 1

nalpha_s.sort()
nalpha_t.sort()

if nalpha_s == nalpha_t:
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

Solution code:
S = list(input())
T = list(input())
res = True
cnt_s = 1
cnt_t = 1  # 何文字連続したか
if len(list(set(S) - set(T))) == len(list(set(T) - set(S))):
    for i in range(len(S) - 1):
        # Sについて判定
        if S[i] == S[i + 1]:
            cnt_s += 1
        # Tについて判定
        if T[i] == T[i + 1]:
            cnt_t += 1
        # 文字の構成が同じか
        if cnt_s == cnt_t:
            pass
        else:
            res = False
            break
else:
    res = False
print('Yes') if res else print('No')

Submission status: Wrong Answer

Solution code:
import sys
import socket

hostname = socket.gethostname()

if hostname == 'F551C':
    sys.stdin = open('c1.in')


def read_int_list():
    return list(map(int, input().split()))


def read_str_list():
    return input().split()


def read_int():
    return int(input())


def read_str():
    return input()


def main():
    S = read_str()
    T = read_str()
    n = len(S)
    res = 'Yes'
    for i in range(n):
        for j in range(n):
            if S[i] != S[j] and T[i] == T[j]:
                res = 'No'
    print(res)


main()

Submission status: Wrong Answer

Solution code:
S=input()
T=input()
L=len(S)
AZ="ABCDEFGHIJKLMNOPQRSTUVWXYZ"
j=0
for i in range(L):
	if S[i:i+1].islower()==True:
		S=S.replace(S[i],AZ[j])
		j=j+1
print(S)
k=0
for i in range(L):
	if T[i:i+1].islower()==True:
		T=T.replace(T[i],AZ[k])  
		k=k+1
print(T)
if S==T:
	print("Yes")
else:
	print("No")

Submission status: Wrong Answer

Solution code:
import collections

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

sv, sc = zip(*s.most_common())
tv, tc = zip(*t.most_common())

if sorted(sv) == sorted(tv) and sorted(sc) == sorted(tc):
    print ("Yes")
else:
    print("No")