Problem:


Score : 100 points

Problem Statement

You are given a 4-character string S consisting of uppercase English letters.
Determine if S consists of exactly two kinds of characters which both appear twice in S.

Constraints

The length of S is 4.

S consists of uppercase English letters.

Input

Input is given from Standard Input in the following format:

S

Output

If S consists of exactly two kinds of characters which both appear twice in S, print Yes; otherwise, print No.

Sample Input 1

ASSA

Sample Output 1

Yes

S consists of A and S which both appear twice in S.

Sample Input 2

STOP

Sample Output 2

No

Sample Input 3

FFEE

Sample Output 3

Yes

Sample Input 4

FREE

Sample Output 4

No



Sample input:
ASSA


Sample output:
Yes

Submission status: Wrong Answer

Solution code:
s = input()
list = []
for l in s:
	if l not in list:
		list.append(l)
if len(list) == 2:
	print('Yes')
else:
	print('no')

Submission status: Wrong Answer

Solution code:
S=input()
if S[0]==S[1] and S[2]==S[3]:
    print('Yes')
elif S[0]==S[2] and S[1]==S[3]:
    print('Yes')
elif S[0]==S[3] and S[1]==S[2]:
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

Solution code:
s = input()
cnt = 0

for i in range(len(s)):
    for j in range(1,len(s)):
        if s[i] == s[j]:
            ++cnt
if cnt % 2 == 0:
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

Solution code:
s = input()
result = 0
for i in s:
  if s.count(i) == 2:
    result = 0
  else:
  	result = 1
if result == 1:
  print("No")
else:
  print("Yes")

Submission status: Wrong Answer

Solution code:
a = input()
if (a[0]==a[1] or a[1]==a[2] or a[2]==a[3]) and len(set(a)) ==2:
    if a.count(list(set(a))[0]) == 2:
        print("Yes")
    else:
        print("No")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
s = list(input())
s = sorted(s)
if s[0] == s[1] and s[2] == s[3] and s[0] != s[2]:
    print("yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
s = input()
count = 0
for i in s:
	if s.count(i) >= 2:
		count += 1

if count == 4:
	print("Yes")
else:
	print("No")

Submission status: Wrong Answer

Solution code:
str=list(input())
if str.count(str[0])==2 and str.count(str[1])==2:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
S = input()


if S[0] == S[1] and S[2] == S[3] or S[0] == S[2] and S[1] == S[3] or S[0] == S[3] and S[1] == S[2]:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
text = input()

text = text.strip(text[0])
if len(text) == 2:  
	text = text.strip(text[0])
	if len(text) == 0:
  		print("Yes")
	else:
  		print("No")
else:
  print("No")

Submission status: Wrong Answer

Solution code:
s = input()
if s[0] == s[1]:
  if s[2] == s[3]:
    print('Yes')
  else:
    print('No')
elif s[0] == s[2]:
  if s[1] == s[3]:
    print('Yes')
  else:
    print('No')
elif s[0] == s[3]:
  if s[1] == s[2]:
    print('Yes')
  else:
    print('No')
else:
  print('No')

Submission status: Wrong Answer

Solution code:
S = input()
if S.count(S[0]) != 4:
    if (S[0] == S[1] and S[2] == S[3]) or (S[0] == S[2] and S[1] == S[3]) or (S[0] == S[3] and S[1] == S[2]):
        print("YES")
        exit()
print("NO")

Submission status: Wrong Answer

Solution code:
S = input()
count1=0
count2=0
count3=0
count4=0

for i in range(4):
  
  if S[i] == S[0] :
    count1+=1
  elif S[i]==S[1]:
    count2+=1
  elif S[i] == S[2]:
    count3+=1
  elif S[i]==S[3]:
    count4+=1
if count2==2 and count1 ==2:
  print("Yes")
else:
  print("No")

Submission status: Wrong Answer

Solution code:
s = input()
if s[1:].count(s[0]) == 1:
    s2 = s[1:].strip(s[0])
    if s2[0] == s2[1]:
        print('Yes')
    else: print('No')
else:
    print("No")

Submission status: Wrong Answer

Solution code:
s=[]
s = input()
cnt=0

if (s[0] == s[1]):
    cnt+=1

if(s[0] == s[2]):
    cnt+=1


if(s[0] == s[3]):
    cnt+=1


if(s[1] == s[2]):
    cnt+=1


if(s[0] == s[3]):
    cnt+=1


if(s[2] == s[3]):
    cnt+=1


if cnt == 2 :
  print("Yes")
else :
  print("No")

Submission status: Wrong Answer

Solution code:
s=list(input())

if s[0]==s[1] or s[0]==s[2] or s[0]==s[3] and s[1]==s[2] or s[1]==s[3] and s[2]==s[3]:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
import collections

if __name__ == '__main__':
    l = list(input())
    c = collections.Counter(l)
    for char, count in c.most_common(2):
        if count != 2:
            print(False)
            exit()
    print(True)

Submission status: Wrong Answer

Solution code:
s = list(input())
s = sorted(s)
if s[0] == s[1] and s[2] == s[3]:
    print("yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
S = input()
answer = 0
for i in range(3):
  count = 1
  for j in range(i, 4):
    if S[i] == S[j]:
      count += 1
  if count == 2:
    answer = 1
if answer == 1:
  print("Yes")
else:
  print("No")

Submission status: Wrong Answer

Solution code:
S = input()
chars = []
res = True
for i in range(len(S)):
  if len(chars) == 0:
    chars += [S[i]]
  elif len(chars) == 1:
    if S[i] == chars[0]:
      continue
    else:
      chars += [S[i]]
  elif len(chars) == 2:
    if S[i] == chars[0] or S[i] == chars[1]:
      continue
    else:
      res = False
print('Yes' if res else 'No')

Submission status: Wrong Answer

Solution code:
str=list(input())
if str.count(str[0])==2 and str.count(str[1])==2:
    print("Yes")
elif str.count(str[0])==4 or str.count(str[1])==4:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
def main():
    s = list(input())
    s_uniq = list(set(s))*2

    a = s.sort()
    b = s_uniq.sort()

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

    else:
        print("No")
main()

Submission status: Wrong Answer

Solution code:
import sys
string = sys.stdin.readline()

from collections import defaultdict
d = defaultdict(int)
for c in string:
    d[c] += 1

d = list(d.values())
if len(d) == 2 and d[0] == 2 and d[1] == 2:
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

Solution code:
s = input()

a = {}

for i in s:
    if i in a:
        a[i] += 1
    else:
        a[i] = 1

if len(a) == 2:
    values = list(a.values())
    if values == [2,2]:
        print("YES")
        exit()
print("NO")

Submission status: Wrong Answer

Solution code:
import numpy as np

S = input()

moji = [i for i in S]

a = moji[0]
for i in range(len(moji)):
    if a != moji[i]:
        b = moji[i]
count = 1
count2 = 1
for i in range(1,len(moji)):
    if moji[i] == a:
        count += 1
    elif moji[i] == b:
        count2 += 1
if count == 2 and count2 == 2:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
s = input()
cnt = 0

for i in range(len(s)-1):
  if(s[i] == s[i+1]):
    cnt = cnt + 1

if(cnt == 2):
  print("Yes")
else:
  print("No")

Submission status: Wrong Answer

Solution code:
s = input()
a = []
a = s.count(s[0])
for i in range(2):
    if s[0] != s[i+1]:
        b = s.count(s[i+1])
        if a + b == 4:
            print("Yes")
        else:
            print("No")
        exit()

Submission status: Wrong Answer

Solution code:
s=str(input())
lst=list(s)
lst.sort()
result = True

if lst[0] == lst[1]:
    if lst[2] == lst[3]:
        if lst[1] != lst[2]:
            result = False

if result:
    print('No')
else:
    print('YES')

Submission status: Wrong Answer

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

s = list(input().replace(" ",""))

F = 0
l = []

if len(s) != 4:
    F=1


for i in s:
    if i == "[A-Z]+":
        F=1
    if i in l:
        l.remove(i)
    else:
        l.append(i)
if F == 1:
    print("No")

elif l == []:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
import sys
s=list(input())

a=s[0]

for x in range(1,4):
  if a!=s[x]:
    b=s[x]
    break

for y in range(1,4):
    if y!=x:
        if a!=s[y] and b!=s[y]:
            print("No")
            sys.exit()
print("Yes")

Submission status: Wrong Answer

Solution code:

char=input()

if len(char)!=4:
	print("No")

elif char[0]==char[1] and char[2]==char[3]:
	print("Yes")
elif char[0]==char[2] and char[1]==char[3]:
	print("Yes")
elif char[0]==char[3] and char[1]==char[2]:
	print("Yes")
else:
	print("No")

Submission status: Wrong Answer

Solution code:
s = input()
if s[0] == s[1]:
  if s[2] == s[3]:
    print('Yes')
  else:
    print('No')
elif s[0] == s[2]:
  if s[1] == s[3]:
    print('Yes')
  else:
    print('No')
elif s[0] == s[3]:
  if s[1] == s[2]:
    print('Yes')
  else:
    print('No')
else:
  print('No')

Submission status: Wrong Answer

Solution code:
s = input()

c = 0
if s.count(s[0]) == 2:
    for i in range(4):
        if s.count(s[i]) == 2:
            c += 1
        else:
            pass
else:
    print("No")
            
if c == 4:
    print("Yes")
else:
    pass

Submission status: Wrong Answer

Solution code:
S = input()
if S[0]==S[1]:
    if S[0]!=S[2] and S[2]==S[3]:
        print('Yes')
elif S[0]==S[2]:
    if S[0]!=S[1] and S[1]==S[3]:
        print('Yes')
elif S[0]==S[3]:
    if S[0]!=S[1] and S[1]==S[2]:
        print('Yes')
else:
    print('No')

Submission status: Wrong Answer

Solution code:
S=input()
if S[0]==S[1]==S[2]:print('No')
elif S[0]==S[1] and S[2]==S[3]:print('Yes')
elif S[0]==S[2] and S[1]==S[3]:print('yes')
elif S[0]==S[3] and S[1]==S[2]:print('Yes')
else:print('No')

Submission status: Wrong Answer

Solution code:
import sys 

word =input()
flag = 0

for i in range(4):
    if word.count(word[i]) == 2:
        flag += 1
    
if flag == 4:
    print("yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
s = input()
count = 0
for i in s:
	count += s.count(i)

if count >= 8:
	print("Yes")
else:
	print("No")

Submission status: Wrong Answer

Solution code:
import numpy as np
S = input()
S_ = list(set(S))
S = np.array(list(S))
S_ = np.array(S_)
print(S_)
ans = 'Yes'
if len(S_)!=2:
    ans = 'No'
elif sum(S==S_[0])!=2:
    ans = 'No'

print(ans)

Submission status: Wrong Answer

Solution code:
A,B,C,D = input()
S = (A+B+C+D)
S1 = S.strip(A)
S2 = S.strip(S1)
if len(S1) == len(S2) and len(S1) == 2:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
S = input()
for i in range(3):
  count = 1
  for j in range(i, 4):
    if S[i] == S[j]:
      count += 1

if count == 2:
  print("Yes")
else:
  print("No")

Submission status: Wrong Answer

Solution code:
str=list(input())
if str.count(str[0])==2 and str.count(str[1])==2:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
S = input()

s = sorted(S)

if s[0] == s [1] and s[2] == s[3]:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
s=input()

if s[0] == s[1]:
    if s[2]==s[3] and s[0]!=s[2]:
        print('Yes')
    else:
        print('No')
elif s[0] == s[2] and s[0]!=s[2]:
    if s[1] == s[3]:
        print('Yes')
    else:
        print('No')
elif s[0] == s[3] and s[0]!=s[2]:
    if s[1] == s[2]:
        print('Yes')
    else:
        print('No')
else:
    print('No')

Submission status: Wrong Answer

Solution code:
s=str(input())
lst=list(s)
lst.sort()
result = True

if lst[0] == lst[1]:
    if lst[2] == lst[3]:
        result = False

if result:
    print('No')
else:
    print('YES')

Submission status: Wrong Answer

Solution code:
#s=list(input())
s=list("ASSA")
d = {}
for hoge in s:
  d[hoge] = d.get(hoge, 0) + 1

for k, v in d.items():
  if(v != 2):
    print("No")
print("Yes")

Submission status: Wrong Answer

Solution code:
s = input()

if (s[0] == s[1]) and (s[2] == s[3]):
    print("Yes")
elif (s[0] == s[2]) and (s[1] == s[3]):
    print("Yes")
elif (s[0] == s[3]) and (s[1] == s[2]):
    print("Yes")
elif (s[1] == s[2]) and (s[0] == s[3]):
    print("Yes")
elif (s[1] == s[3]) and (s[0] == s[2]):
    print("Yes")
elif (s[2] == s[3]) and (s[0] == s[1]):
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:

#Sの入力
s=input()


if s[0] == s[3]:
    if s[1] == s[2]:
        print('Yes')
    else:
        print('No')

elif s[0] == s[2]:
    if s[1] == s[3]:
        print('Yes')
    else:
        print('No')

elif s[0] == s[1]:
    if s[2] == s[3]:
        print('Yes')
    else:
        print('No')
else:
    print('No')

Submission status: Wrong Answer

Solution code:
s = list(input())
if (s[0] == s[1] and s[2] == s[3]) or (s[0] == s[2] and s[1] == s[3]) or (s[0] == s[3] and s[1] == s[2]):
    print("Yes") 
else:
    print("No")

Submission status: Wrong Answer

Solution code:
import sys
string = sys.stdin.readline()

from collections import defaultdict
d = defaultdict(int)
for c in string:
    d[c] += 1

d = list(d.values())
if d[0] == 2 and d[1] == 2:
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

Solution code:
s=list(input())
d = {}
for hoge in s:
	d[hoge] = d.get(hoge, 0) + 1
for k, v in d.items():
	if(v != 2):
		print("NO")
print("YES")

Submission status: Wrong Answer

Solution code:
S = input()
if S[0]==S[1]:
    if S[0]!=S[2] and S[2]==S[3]:
        print('Yes')
elif S[0]==S[2]:
    if S[0]!=S[1] and S[1]==S[3]:
            print('Yes')
elif S[0]==S[3]:
    if S[0]!=S[1] and S[1]==S[2]:
        print('Yes')
else:
    print('No')

Submission status: Wrong Answer

Solution code:
s = list(input())
s.sort()

if s[0] == s[1] and s[2] == s[3]:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
S = str(input())

if S.count(S[0]) == 2:
    new_S = S.strip(S[0])
    if new_S.count(new_S[0]) == 2:
        print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
s = input()

if (( s[0]==s[1] and s[2]==s[3] ) or ( s[1]==s[2] and s[0]==s[3] ) 
   or ( s[0]==s[2] and s[1]==s[3] )) :

    if ( s[0]==s[1] and s[1]==s[2] and s[2]==s[3] ) :

        print('Bad')

    else :

        print('Good')
        
else :
    print('Bad')

Submission status: Wrong Answer

Solution code:
S=input()
if S[0]==S[1] and S[2]==S[3]:print('Yes')
elif S[0]==S[2] and S[1]==S[3]:print('yes')
elif S[0]==S[3] and S[1]==S[2]:print('Yes')
else:print('No')

Submission status: Wrong Answer

Solution code:
S=input()
list1=list(S)
if list1[0]==list1[1] and list1[2]==list1[3]:
  print("Yes")
elif list1[0]==list1[2] and list1[1]==list1[3]:
  print("Yes")
elif list1[0]==list1[3] and list1[1]==list1[2]:
  print("Yes")
else:
  print("No")

Submission status: Wrong Answer

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

if (s1[0] == s1[1] and s1[2] == s1[3]) or (s1[1] == s1[2] and s1[0] == s1[3]) or (s1[0] == s1[2] and s1[1] == s1[3]):
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
s = input()

a = 0
for i in range(1, len(s)):
    if s[0] == s[i]:
        a += 1

b = 0
for i in range(2, len(s)):
    if s[1] == s[i]:
        b += 1

c = 0
for i in range(3, len(s)):
    if s[2] == s[i]:
        c += 1

if a + b + c >= 2:
    print('YES')
else:
    print('NO')

Submission status: Wrong Answer

Solution code:
S = input()
C = 0
if S[0] == S[1]:
	if S[2] == S[3]:
		C = 1
elif S[0] == S[2]:
	if S[1] == S[3]:
		C = 1
elif S[0] == S[3]:
	if S[1] == S[2]:
		C = 1
if C == 1:
	print('Yes')
else:
	print('No')

Submission status: Wrong Answer

Solution code:
S = str(input())

if S.count(S[0]) == 2:
    S.strip(S[0])
    if S.count(S[0]) == 2:
        print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
S = list(input())
S.sort()
if (S[0] == S[1] and S[2]==S[3]) or\
(S[0] == S[3] and S[2]==S[1]) or \
(S[0] == S[2] and S[1]==S[3]):
  print("Yes")
else:
  print("No")

Submission status: Wrong Answer

Solution code:
s = str(input())

if (s[0] == s[1] and s[2] == s[3])or(s[0] == s[2] and s[1] == s[3])or(s[0] == s[3] and s[1] == s[2]):
  print('Yes')
elif s[0] == s[1] and s[0] == s[2] and s[0] == s[3]:
  print('No')
else:
   print('No')

Submission status: Wrong Answer

Solution code:
S = input()

count = 0
fircnt = 0
before = ''
first = ''

cl = set()

for s in S:
    if s not in cl:
        count += 1
        cl.add(s)
        if first == '':
            first = s
    if first == s:
        fircnt += 1

print(count)
print(fircnt)
if count != 2:
    print('No')
elif fircnt == 2:
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

Solution code:
s = input()

a = s[0]
b = s[1]
c = s[2]
d = s[3]

if(a == b and c == d): 
 print('Yes')
elif(a == c and d == b): 
 print('Yes')
elif(a == d and c == b): 
 print('Yes')
else:
 print('No')

Submission status: Wrong Answer

Solution code:
def resolve():
    S = list(input())
    S.sort()
    if ((S[0] == S[1]) & (S[2] == S[3])):
        print("Yes")
    else:
        print("No")
        
resolve()

Submission status: Wrong Answer

Solution code:
M=input()


if M.count(M[0])+ M.count(M[1])+ M.count(M[2])+ M.count(M[3])>=8:
  print("Yes")
else:
  print("No")

Submission status: Wrong Answer

Solution code:

def main():
    S=list(map(str,input()))
    l_duplicate = [x for x in set(S) if S.count(x) ==2]
    if len(l_duplicate):
        print("Yes")
    else:
        print("No")

if __name__=="__main__":
    main()

Submission status: Wrong Answer

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

s = list(input())

F = 0
l = []

if len(s) != 4:
    F=1


for i in s:
    if i == "[A-Z]+":
        F=1
    if i in l:
        l.remove(i)
    else:
        l.append(i)
if F == 1:
    print("No")

elif l == []:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
s=input()
ss=[s[0],s[1],s[2],s[3]]
ss.sort()
if ss[0]==ss[1]and ss[2]==ss[3]:
  print("Yes")
else:
  print("No")

Submission status: Wrong Answer

Solution code:
char=input()

if char[0]==char[1] and char[2]==char[3]:
	print("Yes")
elif char[0]==char[2] and char[1]==char[3]:
	print("Yes")
elif char[0]==char[3] and char[1]==char[2]:
	print("Yes")
else:
	print("No")

Submission status: Wrong Answer

Solution code:
s=list(input())
 
 
if(( s[0]==s[1] and s[2]==s[3] )or( s[0]==s[2] and s[1]==s[3] )or( s[0]==s[3] and s[1]==s[2] )):
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

Solution code:
S = input()
flag =False
S_set = set(list(S))

if len(S_set) == 2:
  count_1 = S.count(list(S_set)[0])
  count_2 = S.count(list(S_set)[1])
  print(count_1,count_2)
  if count_1 == 2 and count_2 == 2:
  	flag = True

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

Submission status: Wrong Answer

Solution code:
S = input()

arr = {}

for i in S:
    if i in arr:
        arr[i] += 1
    else:
        arr[i] = 1

if arr[i] is 2:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
str = input()
count = 0
if str[0] == str[1]:
  if str[2] == str[3]:
    count += 1
elif str[0] == str[2]:
  if str[1] == str[3]:
    count += 1
elif str[0] == str[3]:
  if str[1] == str[2]:
    count += 1
if count == 1:
  print("Yes")
else:
  print("No")

Submission status: Wrong Answer

Solution code:
s=list(input())
d = {}
for hoge in s:
  d[hoge] = d.get(hoge, 0) + 1

for k, v in d.items():
  if(v != 2):
    print("NO")
print("YES")

Submission status: Wrong Answer

Solution code:
import sys
s = input()
s1= s[:1]
s2 = s[1:2]
s3 = s[2:3]
s4 = s[3:4]
if s1 == s2:
	if s3 == s4:
		if s1 != s3:
			print("Yes")
			sys.exit(0)
if s1 == s3:
	if s2 == s4:
		if s1 != s3:
			print("Yes")
			sys.exit(0)
if s1 == s4:
	if s2 == s3:
		if s1 != s3:
			print("Yes")
			sys.exit(0)
print("No")

Submission status: Wrong Answer

Solution code:
s=input()
ss=[s[0],s[1],s[2],s[3]]
ss.sort()
print(ss)
if ss[0]==ss[1]and ss[2]==ss[3]:
  print("Yes")
else:
  print("No")

Submission status: Wrong Answer

Solution code:
#a.py
lis = []
s = input()
flag = 0
two = 0
for x in s:
    if x in lis:
        flag += 1
    else:
        two += 1
    lis.append(x)
if two <= 2 and  flag <= 3:
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

Solution code:
s=input()
ch1=s[0]
c1=1
c2=0
for i in range(1,4):
    if s[i]==ch1:
        c1=c1+1
    if s[i]!=ch1:
        if c2==0:
            ch2=s[i]
            c2=c2+1
            continue
        if c2!=0:
            if s[i]!=ch2:
                break
            if s[i]==ch2:
                c2=c2+1

if c1==2 or c2==2:
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

Solution code:
S=input()
S.split()
if S[0]==S[1]:
    if S[2]==S[3]:
        if not S[1]==S[3]:
            print("Yes")
        else:
            print("No")
    else:
        print("No")
elif S[0]==S[2]:
    if S[1]==S[3]:
        if not S[1]==S[2]:
            print("Yes")
        else:
            print("No")
    else:
        print("No")

elif S[0]==S[3]:
    if S[2]==S[1]:
        if not S[0]==S[2]:
            print("Yes")
        else:
            print("No")
    else:
        print("No")

Submission status: Wrong Answer

Solution code:
S = input()

if S[0] == S[1] and S[2] == S[3]:
    print("Yes")
elif S[0] == S[2] and S[1] == S[3]:
    print("Yes")
elif S[0] == S[3] and S[1] == S[2]:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
S = list(input())
if S[0] == S[1]:
  if S[1] == S[2]:
    print('No')
  elif S[2] == S[3]:
    print('Yes')
elif S[0] == S[2]:
  if S[1] == S[3]:
    print('Yes')
  else:
    print('No')
elif S[0] == S[3]:
  if S[1] == S[2]:
    print('Yes')
  else:
    print('No')
else:
  print('No')

Submission status: Wrong Answer

Solution code:
s = input()

d = {}
for x in list(s):
    if x in d:
        d[x] += 1
    else:
        d[x] = 1

print(d)
if len(d.keys()) == 2:
    t = True
    for e in d:
        if d[e] != 2:
            t = False
    if t:
        print("Yes")
    else:
        print("No")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
s=input()

if s[0] == s[1]:
    if s[2]==s[3]:
        print('Yes')
    else:
        print('No')
elif s[0] == s[2]:
    if s[1] == s[3]:
        print('Yes')
    else:
        print('No')
elif s[0] == s[3]:
    if s[1] == s[2]:
        print('Yes')
    else:
        print('No')
else:
    print('No')

Submission status: Wrong Answer

Solution code:
S = input()

if S.count(S[0]) == 2 or S.count(S[1]) == 2 or S.count(S[2]) == 2:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
list1 = list(input())
#list1.sort()
if (list1[0]==list1[1] and list1[2]==list1[3] and list1[2]!=list1[1]):
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
import sys
string = sys.stdin.readline()

from collections import defaultdict
d = defaultdict(int)
for c in string:
    d[c] += 1

d = list(d.values())
if len(d) == 2 and d[0] == 2:
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

Solution code:
s = list(input())

a = sorted(s)

print(a)

if a[0] == a[1] and a[2] == a[3] and a[0] != a[2]:
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

Solution code:
s = input()
temp = s[0] 
count = 0
for j in range(4):
	for i in s:
		if temp == i:
			count += 1
	temp = s[j]

if count > 6:
	print("Yes")
else:
	print("No")

Submission status: Wrong Answer

Solution code:
a = input().split()
b = list(set(a))
if len(b) == 2:
  count = 0
  for i in range(1,3):
    if a[i] == a[0]:
      count +=1
  if count ==2:
    print("Yes")
  else:
    print("No")
else:
  print("No")

Submission status: Wrong Answer

Solution code:
S = input()
lst = []
for i in S:
    lst.append(i)
s = sorted(lst)
if s[0] == s[1] and s[2] == s[3]:
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

Solution code:
inp=input()
ans=0
for s in inp:
  if inp.count(s)%2==2:
    ans=ans;
  else:
    ans+=1
if ans==0:
  print('Yes')
else:
  print('No')

Submission status: Wrong Answer

Solution code:
count = 0
s = list(str(input()))

if s[0] == s[1]:
    if s[2] == s[3]:
        count = 1
elif s[0] == s[2]:
    if s[1] == s[3]:
        count = 1
elif s[0] == s[3]:
    if s[1] == s[2]:
        count = 1

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

Submission status: Wrong Answer

Solution code:
s = input()

if s[0] == s[1] and s[2] == s[3] and s[1] != s[2]:
    print('Yes')
elif s[0] == s[2] and s[1] == s[3] and s[1] != s[1]:
    print('Yes')
elif s[0] == s[3] and s[1] == s[2] and s[0] != s[1]:
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

Solution code:
Inp = list(input())
Inp.sort()

if Inp[0] == Inp[1] and Inp[2] == Inp[3]:
	print('Yes')
else:
	print('No')

Submission status: Wrong Answer

Solution code:
a = list(input())
if a[0] == a[1] and a[2] == a[3]:
  print('Yes')
elif a[0] == a[2] and a[1] == a[3]:
  print('Yes')
elif a[0] == a[3] and a[1] == a[2]:
  print('Yes')
else:
  print('No')

Submission status: Wrong Answer

Solution code:
s = str(input())

if ((s[0] == s[1] and s[2] == s[3])or(s[0] == s[2] and s[1] == s[3])or(s[0] == s[3] and s[1] == s[2])):
  print('Yes')
elif s[0] == s[1] and s[1] == s[2] and s[2] == s[3]:
  print('No')
else:
   print('No')

Submission status: Wrong Answer

Solution code:
s = input()

s = sorted(s)

if s[0] == s[1] and s[2] == s[3]:
    print("Yes")
    exit()

print("No")

Submission status: Wrong Answer

Solution code:
import numpy as np

S = input()

moji = [i for i in S]

a = moji[0]
count = 1
for i in range(1,len(moji)):
    if moji[i] == a:
        count += 1
if count == 2:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
s = input()

if (s[0] == s[1]) and (s[2] == s[3]):
    print("Yes")

elif (s[0] == s[2]) and (s[1] == s[3]):
    print("Yes")

elif (s[0] == s[3]) and (s[1] == s[2]):
    print("Yes")
elif (s[1] == s[2]) and (s[0] == s[4]):
    print("Yes")
elif (s[1] == s[3]) and (s[0] == s[2]):
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
S = [s for s in input()]
cnt = {}
for s in S:
    if s not in cnt:
       cnt[s] = 0
    cnt[s] += 1
if len(cnt) == 2 and cnt[s] == 2:
    print("YES")
else:
    print("NO")

Submission status: Wrong Answer

Solution code:
import collections

string = str(input())

c = collections.Counter(list(string))

if c.values == [2, 2]:
    print('Yes')

else:
    print('No')

Submission status: Wrong Answer

Solution code:
s = list(input())
s.sort()
if s[0] == s[1] and s[2] == s[3]:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
S = input()
flag =False
S_set = set(list(S))

if len(S_set) == 2:
  count_1 = S.count(list(S_set)[0])
  count_2 = S.count(list(S_set)[1])
  if count_1 == 2 and count_2 == 2:
  	falg = True

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

Submission status: Wrong Answer

Solution code:
x = input()

a = 1
b = 1
other = '0'

for i in range(1,4):
  if x[0] == x[i]:
    a += 1
  else:
    if other == x[i]:
      b += 1
    else:
      other = x[i]
      
print(a)
print(b)
if a == b == 2:
  print("Yes")
else:
  print("No")

Submission status: Wrong Answer

Solution code:
S=list(input())
if (S[0]==S[1] or S[0]==S[2] or S[0]==S[3]) and (S[1]==S[2] or S[1]==S[3]): 
  print('Yes')
else:
  print('No')

Submission status: Wrong Answer

Solution code:
n = list(input())
flag = 0
dict = {}
for i in n:
    if i in dict:
        dict[i] += 1
    else:
        dict[i] = 1
 
for key,val in dict.items():
    if val != 2:
        flag = 1
 
if flag:
    print("Bad")
else:
    print("Yes")

Submission status: Wrong Answer

Solution code:
s = input()
st = []
for i in s:
        st.append(i)
st.sort()
if(st[0] == st[1] and st[2]== st[3]):
        print("Yes")
else:
        print("No")

Submission status: Wrong Answer

Solution code:

import sys
input = sys.stdin.readline
#-------------------------------------
import collections

s = list(input())

c = collections.Counter(s)

if len(c.keys()) == 2 and c.most_common()[0][1]:
        print("Yes")
else:
        print("No")

Submission status: Wrong Answer

Solution code:
S = input()
if (S[0] == S[1] and S[2] == S[3]) or (S[0] == S[2] and S[1] == S[3]) or (S[0] == S[3] and S[1] == S[2]):
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

Solution code:
flg = False
s = input()
s1, s2, s3, s4 = s[:1], s[1:2], s[2:3], s[3:4]
if s1 == s2 and s3 == s4:
	flg = True
elif s1 == s3 and s2 == s4:
	flg = True
elif s1 == s4 and s2 == s3:
	flg = True

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

Submission status: Wrong Answer

Solution code:
import fractions
from collections import deque
import numbers as np


def main():
    S = input()
    s1 = S[0]
    S = S[1:]
    s2 = ''
    for i in range(len(S)):
        if s1 != S[i]:
            s2 += S[i]
        else:
            s1 += S[i]
    print('Yes' if len(s1) == 2 and len(s2) == 2 else 'No')


if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
a = input()
if (a[0]==a[1] or a[1]==a[2] or a[2]==a[3]) and len(set(a)) ==2:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
# A
S = input()
if S[0] == S[1] and S[2] == S[3]:
    print('Yes')
elif S[0] == S[2] and S[1] == S[3]:
    print('Yes')
elif S[0] == S[3] and S[1] == S[2]:
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

Solution code:
s = input()
for i in range(4):
    if s.count(s[i]) != 2:
        print('No')
        break
    else:
        print('Yes')
        break

Submission status: Wrong Answer

Solution code:
a=input()
x = [a[i:i+1] for i in range(len(a))]
if (a[0]==a[1] and a[2]==a[3]) or (a[0]==a[2] and a[1]==a[3]) or (a[0]==a[3] and a[1]==a[2]):
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
import sys

text = input()
list = [e for e in set(text)]

if set(text) == 2:
  for e in list:
    if text.count(e) != 2:
      print('No')
      sys.exit()
else:
  print('No')
  sys.exit()
  
print('Yes')

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
S = input().split()
 
s = str(S)
s = s[2:-2]

if s[2] == s[0]:
  if (s[3] == s[1]) and (s[3] != s[0]):
    print("Yes")
  else:
    print("No")
elif s[2] == s[1]:
  if (s[3] == s[0]) and (s[3] != s[1]):
    print("Yes")
  else:
    print("No")
else:
  print("No")

Submission status: Wrong Answer

Solution code:
S = input()
count1=0
count2=0
for i in range(4):
  if S[i] == S[0] :
    count1+=1
  else:
    count2+=1
    
if count2==2 and count1 ==2:
  print("Yes")
else:
  print("No")

Submission status: Wrong Answer

Solution code:
s = input()

s = sorted(s)

if s[0] == s[1] == [2] or s[1] == s[2] == [3] or s[0] != s[1] or s[2] != s[3]:
    print("No")
    exit()

print("Yes")

Submission status: Wrong Answer

Solution code:
s = input()
if s[0] == s[1]:
    if s[2] == s[3]:
        print("Yes")
    else:
        print("No")
elif s[0] == s[2]:
    if s[1] == s[3]:
        print("Yes")
    else:
        print("No")
elif s[0] == s[3]:
    if s[1] == s[2]:
        print("Yes")
    else:
        print("No")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
S = input()
if len(set(S)) != 2:
    print("NO")
    exit(0)
c = 0
c0 = S[0]
for ch in S:
    if ch == c0:
        c += 1
if c == 2:
    print("YES")
else:
    print("NO")

Submission status: Wrong Answer

Solution code:
s = input()

if s[0] == s[1] and s[2]==s[3]:
    print('Yes')
elif s[0] == s[2] and s[1] == s[3]:
    print('Yes')
elif s[0] == s[3] and s[1]==s[2]:
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

Solution code:
S = input()
if (S[0]==S[1] and S[2]==S[3]) or (S[0]==S[2] and S[1]==S[3]) or (S[0]==S[3] and S[1]==S[2]):
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
s = input()
if s[0] == s[1] == s[2] == s[3]:
    print('No')
elif s[0] == s[1] and s[1] == s[2]:
    print('Yes')
elif s[0] == s[2] and s[1] == s[3]:
    print('Yes')
elif s[0] == s[3] and s[1] == s[2]:
    print('Yes')
else:
    print('No')