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:
word = input()
dict_word = {}
for i in range(len(word)):
  try:
    count = dict_word[word[i]]
    dict_word[word[i]] += 1
  except:
    dict_word[word[i]] = 1


if len(dict_word) == 2 and list(dict_word.values()) == [2, 2]:
  print('YES')
else:
  print('NO')

Submission status: Wrong Answer

Solution code:
x=list(input())

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

Submission status: Wrong Answer

Solution code:
d={}
A = input()
for i in range(len(A)):
    if d.get(A[i],None)==None:
        d[A[i]]=1
    else:
        d[A[i]]+=1

if(max(d.values())==2):
    print("Yes")
else:print("No")

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
s = input()

#文字列を1文字ずつリストにする！
moji = list(s)
#リストをそーとする！
moji.sort()

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

Submission status: Wrong Answer

Solution code:
s = input()

#文字列を1文字ずつリストにする！
moji = list(s)
#リストをそーとする！
moji.sort()

if moji[0] != moji[1]:
    print('NO')
else:
    if moji [0] == moji[2]:
        print('NO')
    elif moji[2] == moji[3]:
        print('YES')

Submission status: Wrong Answer

Solution code:

input = input().split()
inputList = list(input[0])
# a = int(input[0])
# b = int(input[1])
# c = int(input[2])

inputList.sort()

flg = 1
for i in range(0, len(inputList)-1, 2):
    if inputList[i] != inputList[i + 1]:
        flg = 0
        break

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

Submission status: Wrong Answer

Solution code:

input = input().split()
inputList = list(input)
# a = int(input[0])
# b = int(input[1])
# c = int(input[2])

inputList.sort()

flg = 1
for i in range(0, len(inputList)-1, 2):
    if inputList[i] != inputList[i + 1]:
        flg = 0
        break

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

Submission status: Wrong Answer

Solution code:
s = input()
if(s.count('F') == 2 and s.count('E') == 2):
  print("Yes")
else:
  print("No")

Submission status: Wrong Answer

Solution code:
import collections
S = input()

c = collections.Counter(S)
values, counts = zip(*c.most_common())

if counts == (2, 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")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
S = input()

ans="No"
if S[0] == S[1] and S[0] != S[2] and S[0] != S[3]:
  ans = "Yes"
elif S[1] == S[2] and S[1] != S[0] and S[1] != S[3]:
  ans = "Yes"
elif S[2] == S[3] and S[2] != S[0] and S[2] != S[1]:
  ans = "Yes"
elif S[3] == S[0] and S[3] != S[1] and S[3] != S[2]:
  ans = "Yes"

print(ans)

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()
chars = []
for i in range(len(S)):
    chars.append(S[i])
if chars.count(chars[0]) == 2:
    for i in range(len(S)):
        if chars.count(chars[i]) != 2:
            print("NO")
            break
    else:
        print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
S = input()
chars = []
for i in range(len(S)):
    chars.append(S[i])
if chars.count(chars[0]) == 2:
    for i in range(len(S)):
        if chars.count(chars[i]) != 2:
            break
    else:
        print("Yes")
else:
    print("No")

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
S = input()
chars = sorted(list(S))
if chars[0] == chars[1] and chars[2] == chars[3]:
    print("YES")
else:
    print("NO")

Submission status: Wrong Answer

Solution code:
S = input()
if S.count(S[0])==2 and S.count(S[1])==2 and S.count(S[2])==2:
  print('Yes')
print('No')

Submission status: Wrong Answer

Solution code:
S = input()
s1 = S[0]
out = 'No'
s1_list = list(filter(lambda x: x == s1, S))
if len(s1_list) == 2:
    s2_list = list(filter(lambda x: x != s1, S))
    if len(s2_list) == 2:
        out = 'Yes'
print(out)

Submission status: Wrong Answer

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


if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
import sys
S = input()
M = []
for i in range(4):
  M.append(S[i])
M = sorted(M)
if M[0] == M[1]:
  if M[2] == M[3]:
    print("Yes")
    sys.exit()
print("No")

Submission status: Wrong Answer

Solution code:
import numpy as np
from collections import Counter

s = input()
c = Counter(s)
if (len(c) == 2) & (list(c.values()) == [2, 2]):
    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")
if s[0] == s[2] and s[1] ==s[3] and s[1] !=s[2]:
  print("Yes")
if s[0] == s[3] and s[1] ==s[2] and s[1] !=s[0]:
  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")
if s[0] == s[2] and s[1] ==s[3] and s[1] !=s[2]:
  print("YES")
if s[0] == s[3] and s[1] ==s[3] and s[1] !=s[0]:
  print("YES")
else:
  print("NO")

Submission status: Wrong Answer

Solution code:
s = input()
ss = sorted(s)

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

Submission status: Wrong Answer

Solution code:
s = input()
ss = sorted(s)

if ss[0] == ss[1] and ss [2] == ss[3]:
  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 = (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()
print(sorted(S))

flag = "Yes"

for i in S:
    if S.count(i)!=2:
        flag = "No"
        
print(flag)

Submission status: Wrong Answer

Solution code:
S=input()
print(sorted(S))

flag = "YES"

for i in S:
    if S.count(i)!=2:
        flag = "NO"
        
print(flag)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
s = input()
s = s.replace(s[0], '', 2)
s = s.replace(s[0], '', 2)
print("Yes" if len(s) == 0 else "No")

Submission status: Wrong Answer

Solution code:
s=list(input())

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

Submission status: Wrong Answer

Solution code:
s=list(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 b==d:
  print('Yes')
elif a==d and c==d:
  print('Yes')
else:
  print('No')

Submission status: Wrong Answer

Solution code:
A = input()
B = [i for i in A]
if B.count(B[0]) == 2:
  print("Yes")
else:
  print("No")

Submission status: Wrong Answer

Solution code:
a,b,c,d = sorted(input())

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

Submission status: Wrong Answer

Solution code:
a = input()

str_list = list(a)

str_list.sort()

#print(str_list)

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
y = sorted(list(input()))

if (y[0] == y[1]) and(y[2]== y[3])and(y[0]!=y[2]):
    print('YES')
else:
    print('NO')

Submission status: Wrong Answer

Solution code:
y = sorted(str(input()))

if (y[0] == y[1]) and(y[2]== y[3])and(y[0]!=y[2]):
    print('YES')
else:
    print('NO')

Submission status: Wrong Answer

Solution code:
y = sorted(str(input()))

if (y[0] == y[1]) and(y[2]== y[3])and(y[0]!=y[1]):
    print('YES')
else:
    print('NO')

Submission status: Wrong Answer

Solution code:
y = sorted(str(input()))

if (y[0] == y[1]) and(y[2]== y[3]):
    print('YES')
else:
    print('NO')

Submission status: Wrong Answer

Solution code:
S=input()

judge=True
for i in range(4):
  counter=int(0)
  for j in range(4):
    if S[i]==S[j]:
      counter+=1
      
  if counter!=2:
    judge=False
    
if judge:
  print('YES')
else:
  print('NO')

Submission status: Wrong Answer

Solution code:
S=input()

judge=True
for i in range(4):
  counter=0
  for j in range(4):
    if S[i]==S[j]:
      counter+=1
      
  if counter!=2:
    judge=False
    
if judge:
  print('YES')
else:
  print('NO')

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
t = input()
a = [i for i in t]
print(a)
b = list(set(a))
if len(b) == 2:
    if a.count(a[0]) ==2:
        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[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:
a=input()
for x in range(int(len(a))):
    if a.count(a[x])!=2:
        print("No")
        break
    else:
        print("Yes")
        break

Submission status: Wrong Answer

Solution code:
a=input()
for x in range(int(len(a))):
    c=a.count(a[x])
    if c!=2:
        print("No")
        break
    else:
        print("Yes")
        break

Submission status: Wrong Answer

Solution code:
a=input()
for x in range(4):
    c=a.count(a[x])
    if c!=2:
        print("No")
        break
    else:
        print("Yes")
        break

Submission status: Wrong Answer

Solution code:
chars = list(input())

result = True
for i in range(4):
  dummy = chars.copy()
  a = dummy.pop(i)
  if not (a in dummy):
    result = False

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

Submission status: Wrong Answer

Solution code:
s = input()
cmp = s[0]
cnt1 = 1
cnt2 = 0
for i in range(1, len(s)):
    if s[i] == cmp:
        cnt1 += 1
    else:
        cnt2 += 1
if cnt1 == 2 and cnt2 == 2:
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

Solution code:
s = input()
cmp = s[0]
cnt = 1
for i in range(1, len(s)):
    if s[i] == cmp:
        cnt += 1
    else:
        cnt -= 1
if cnt == 0:
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

Solution code:
s = input()
cmp = s[0]
cnt = 0
for i in range(1, len(s)):
    if s[i] == cmp:
        cnt += 1
    else:
        cnt -= 1
if cnt == 0:
    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')
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()

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('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:
a = input()
print(a)
msg1 = "@"
msg2 = "#"
countmsg1 = 0
countmsg2 = 0
flag = 0
for strliteral in a:
    if strliteral == msg1:
        countmsg1 += 1
    elif strliteral == msg2:
        countmsg2 += 1
    else:
        if msg1 == "@":
            msg1 = strliteral
            countmsg1 += 1
        else:
            if msg2 == "#":
                msg2 = strliteral
                countmsg2 += 1
if countmsg2 == 2 and countmsg2 == 2:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
s = input()
t = list(s.encode('us-ascii'))
t.sort()
if t[0] == t[1] and t[2] == t[3]:
  print('Yes')
else:
  print('No')

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import sys

S = input()
if len(S) > 4:
  print("No")
  sys.exit()
else:  
  if S[0]==S[1] and S[2]==S[3]:
    print("Yes")
    sys.exit()
  if S[0]==S[2] and S[1]==S[3]:
    print("Yes")
    sys.exit()
  if S[0]==S[3] and S[1]==S[2]:
    print("Yes")
    sys.exit()
  else:
    print("No")

Submission status: Wrong Answer

Solution code:
import sys

S = input()
if len(S) > 4:
  print("No")
  sys.exit()  
if S[0]==S[1] and S[2]==S[3]:
  print("Yes")
  sys.exit()
if S[0]==S[2] and S[1]==S[3]:
  print("Yes")
  sys.exit()
if S[0]==S[3] and S[1]==S[2]:
  print("Yes")
  sys.exit()
else:
  print("No")

Submission status: Wrong Answer

Solution code:
import sys

S = input()
if S[0]==S[1] and S[2]==S[3]:
  print("Yes")
  sys.exit()
if S[0]==S[2] and S[1]==S[3]:
  print("Yes")
  sys.exit()
if S[0]==S[3] and S[1]==S[2]:
  print("Yes")
  sys.exit()
if len(S) > 4:
  print("No")
  sys.exit()  
else:
  print("No")

Submission status: Wrong Answer

Solution code:
import sys

S = input()
if S[0]==S[1] and S[2]==S[3]:
  print("Yes")
  sys.exit()
if S[0]==S[2] and S[1]==S[3]:
  print("Yes")
  sys.exit()
if S[0]==S[3] and S[1]==S[2]:
  print("Yes")
  sys.exit()
else:
  print("No")

Submission status: Wrong Answer

Solution code:
x = input()
if x.count(x[0]) > 1 and x.count(x[1]) > 1 and x.count(x[2]) > 1 and x.count(x[3]) > 1:
  print('Yes')
else:
  print('No')

Submission status: Wrong Answer

Solution code:
x = input()
if x.count(x[0]) > 1 and x.count(x[1]) > 1 and x.count(x[2]) > 1:
  print('Yes')
else:
  print('No')

Submission status: Wrong Answer

Solution code:
S   =   input()

for i in range(int(len(S)/2)):
    if(S.count(S[i]) !=2 ):
        print("No")
        exit()
print("Yes")

Submission status: Wrong Answer

Solution code:
#ABC132 A
S = list(input())
S.sort()
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:
def main():
  s = input()
  if len(set(s)) == 2:
    a = 0
    for i in range(1, 3):
      a += 1 if s[0] == s[i] else 0
    print('Yes' if a == 1 else 'No')
  else:
    print('No')


if __name__ == '__main__':
  main()

Submission status: Wrong Answer

Solution code:
str_list = input()
cnt=0
for i in range(4):
  if str_list[i] == str_list[0]:
    cnt+=1
if (len(set(str_list))==2) and (cnt==2):
  print("YES")
else:
  print("NO")

Submission status: Wrong Answer

Solution code:
s=list(input())
if len((s))==2:
  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')
else:
  print('No')

Submission status: Wrong Answer

Solution code:
s=list(input())
if len((s))==2:
  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] or s[1]==s[2]):
    print('Yes')
  else:
    print('No')
else:
  print('No')

Submission status: Wrong Answer

Solution code:
S=sorted(list(input()))
if S[0]==S[1] and S[1]!=S[2] and S[2]==S[3]:
    print("YES")
else:
    print("NO")

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
S = input()
ans = sorted(list(S))
print("Yes" if ans[0] == ans[1] and ans[2] == ans[3] else "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 b==d:
  print("Yes")
elif a==d and b==c:
  print("Yes")
else:
  print("No")

Submission status: Wrong Answer

Solution code:
s = input()
                                                                                                                                                                             
list_sorted = sorted([s[i] for i in range(4)])
if list_sorted[0] == list_sorted[1] and  list_sorted[2] == list_sorted[3] :
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
s=list(input())
s.sort()
ans = "NO"
if s[0]==s[1]:
  if s[1]!=s[2]:
    if s[2]==s[3]:
      ans="Yes"
print(ans)

Submission status: Wrong Answer

Solution code:
S = list(input())
ans = 'Yes'
for i in set(S):
    print(i)
    if not(S.count(i) == 2):
        ans = 'No'
        break

print(ans)

Submission status: Wrong Answer

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

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()
h=set()
for i in range(0,len(s)):
	h.add(s[i])
if(len(s)==2):
	print("Yes")
else:
	print("No")

Submission status: Wrong Answer

Solution code:
from collections import Counter
s = input()
s_list = list(s)
if s_list[0]==s_list[1] and s_list[2]==s_list[3]:
    print("Yes")
elif s_list[0]==s_list[2] and s_list[1]==s_list[3]:
    print("Yes")
elif s_list[0]==s_list[3] and s_list[1]==s_list[2]:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
S = list(input())
U = []
ans = 0
for i in range(4):
  count = 0
  if count == 2:
    ans += 1
  for j in range(i, 4):
    if S[i] == S[j] and S[i] not in U:
      count += 1
    U.append(S[i])
if ans == 2:
  print("Yes")
else:
  print("No")

Submission status: Wrong Answer

Solution code:
s = list(input())
s.sort()
print(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=sorted(list(input()))
if s[0]==s[1] and s[2]==s[3]:
    print("Yes")
else:print("No")

Submission status: Wrong Answer

Solution code:
s = input()

for i in range(4):
    flg = False
    letter = s[i]
    if s.count(letter) == 2:
        flg = True
        break

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

Submission status: Wrong Answer

Solution code:
s = input().split()
s = [c for c in s[0]]

if s[0] == s[1] and s[1] == s[2]:
        print('No')

else:
    for i in range(1, len(s)):
        if s[0] == s[i]:
            buf = i
        else:
            buf = 0
    if buf == 0:
        print('No')
    else:
        print(buf)
        nokori = []
        for i in range(1, len(s)):
            if i == buf:
                continue
            else:
                nokori.append(s[i]) 
                print(nokori)
        if nokori[0] == nokori[1]:
            print('Yes')
        else:
            print('No')

Submission status: Wrong Answer

Solution code:
# 文字列の入力
S = input()

# 判定
if S.count(S[0]) == S.count(S[1]) == S.count(S[2]) == S.count(S[3]) == 2:
    print("YES")
    
else:
    print("NO")

Submission status: Wrong Answer

Solution code:
inputs_array = list(input())
check_dict = {}

is_words = False
is_two = True

for later in inputs_array:
  if later in check_dict:
    check_dict[later] += 1
  else:
    check_dict[later] = 1
    
for v in check_dict:
  if check_dict[v] == 2:
    continue
  else:
    is_two = False
    break

if len(check_dict) == 2:
  is_words = True
  
if is_words and is_two:
  print('YES')
else:
  print('NO')

Submission status: Wrong Answer

Solution code:
S = input()

s = []
count = 0

for i in range(0, len(S)):
    s.append(S[i])

s = sorted(s)

a = s[0]
b = s[2]

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

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

Submission status: Wrong Answer

Solution code:
S = input()

s = []
a = 0
count = 0

for i in range(0, len(S)):
    s.append(S[i])

for i in range(0, len(s)):
    if a == s[i]:
        print('Bad')
    else:
        a = s[i]
        count += 1

if count == 4:
    print('Good')

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
S = [str(a) for a in input()]

S_0 = S.count(S[0])
S_1 = S.count(S[1])

if S_0 == 2 and S_1 == 2:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
S=list(input())
H=['']*4
for i in range(4):
    H[i]=S[i]
A=list(set(H))
if S.count(A[0])==2 and S.count(A[1])==2:
    print('Yes')
else:
    print('No')
print(H)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
S=input()
L=[str(c) for c in S]
if L[0] ==L[1]:
  if L[2]==L[3]:
    print("Yes")
  else:
    print("No")
elif L[0]==L[2]:
  if L[1]==L[3]:
    print("Yes")
  else:
    print("No")
elif L[0]==L[3]:
  if L[1]==L[2]:
    print("Yes")
  else:
    print("No")
else:
  print("No")

Submission status: Wrong Answer

Solution code:
s = input()


s1 = s[0]
if s.count(s1) == 2:
    s.replace(s1,"")
    s2 = s[0]
    if s.count(s2) == 2:
        print("Yes")
    else:
        print("No")
else:
    print("No")

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
S = list(input())
if(len(S) == 4):
    if (S == S[::-1]):
        print("Yes")
    else:
        for i in range(1):
            if(S[i] == S[i+1] and S[i+2] == S[i+3]):
                print("Yes")
                break
            if(S[i] == S[i+2] and S[i+1] == S[i+3]):
                print("Yes")
                break
            print("No")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
S = list(input())
if (S == S[::-1]):
    print("Yes")
else:
    for i in range(1):
        if(S[i] == S[i+1] and S[i+2] == S[i+3]):
            print("Yes")
            break
        if(S[i] == S[i+2] and S[i+1] == S[i+3]):
            print("Yes")
            break
        print("No")

Submission status: Wrong Answer

Solution code:
S = list(input())
if (S == S[::-1]):
    print("Yes")
else:
    for i in range(1):
        if(S[i] == S[i+1] and S[i+2] == S[i+3]):
            print("Yes")
            break
        if(S[i] == S[i+2] and S[i+1] == S[i+3]):
            print("Yes")
            break
        else:
            print("No")

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
s = input()
sr = s.replace(s[0], '')
if len(sr) == 2 and sr[0].count == 2:
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

Solution code:
s = input()
if len(s.replace(s[0],'')) == 2:
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
S = input()

S = [s for s in S]

S.remove(S[0])

if len(S) != 2:
    print('No')
else:
    if S[0] == S[1]:
        print('Yes')
    else:
        print('No')

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
A = input()
S = sorted(A)

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

Submission status: Wrong Answer

Solution code:
import sys
s = input()
a = s[0]
if s.count(a) != 2:
  print("No")
  sys.exit()
s.replace(a,"")

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

Submission status: Wrong Answer

Solution code:
import sys
s = input()
a = s[0]
if s.count(a) != 2:
  print("No")
  sys.exit()
s.replace(a,"")
b = s[0]
if s.count(b) != 2:
  print("No")
  sys.exit()
print("Yes")

Submission status: Wrong Answer

Solution code:
import sys
s = input()
a = s[0]
if s.count(a) != 2:
  print("No")
  sys.exit()
s.strip(a)
b = s[0]
if s.count(b) != 2:
  print("No")
  sys.exit()
print("Yes")

Submission status: Wrong Answer

Solution code:
S = input()
l = list(S)
if l.count(l[0]) == 2 and l.count(l[1]) == 2 and l.count(l[2]) == 2 and l.count(l[3]) == 2 :
  print('Yse')
else:
  print('No')

Submission status: Wrong Answer

Solution code:
S = input()
l = list(S)
l_unique = list(set(l))
count = 0
for i in range(len(l_unique)):
  if l.count(l_unique[i]) == 2 :
    count += 1
if count == len(l) //2 :
  print('Yse')
else:
  print('No')

Submission status: Wrong Answer

Solution code:
s = input()
s = set(s[i] for i in range(len(s)))
if 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]) :
    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[0] ==S[3] == S[1] == S[2]):
    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=input()
if(s.islower()):
    print("NO")
else:
    dic={}
    for i in s:
        if(i in dic.keys()):
            dic[i]+=1
        else:
            dic[i]=1
    if(len(list(dic.keys()))==2):
        print("YES")
    else:
        print("NO")
    # print(list(dic.keys()))

Submission status: Wrong Answer

Solution code:
s=input()
dic={}
for i in s:
  if(i in dic.keys()):
    dic[i]+=1
  else:
    dic[i]=1
if(len(list(dic.keys()))==2):
  print("YES")
else:
  print("NO")
# print(list(dic.keys()))

Submission status: Wrong Answer

Solution code:
s=input()
dic={}
for i in s:
  if(i in dic.keys()):
    dic[i]+=1
  else:
    dic[i]=1
if(len(dic.keys())==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:
#文字入力
str = input() 

#文字列の長さ取得
str_leg = len(str)

#判定

count = 0
#(0,1)(0,2)(0,3)(1,2)(1,3)(2,3)
for i in range(0, str_leg - 1):
    for j in range(i+1, str_leg):
        if (str[i] == str[j]):
             count = count + 1 

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

Submission status: Wrong Answer

Solution code:
#文字入力
str = input() 

#文字列の長さ取得
str_leg = len(str)


#判定

count = 0
#(0,1)(0,2)(0,3)(1,2)(1,3)(2,3)
for i in range(0, str_leg - 1):
    for j in range(i+1, str_leg):
        if (str[i] == str[j]):
             count = count + 1 

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

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()

letters = []
for i in range(4):
  if not s[i] in letters:
    letters.append(s[i])
  
if len(letters)==2 and s.count(s[0])==2:
  print('Yes')
else:
  print('No')

print(letters)

Submission status: Wrong Answer

Solution code:
s = input()

letters = []
for i in range(4):
  if not s[i] in letters:
    letters.append(s[0])
  
if len(letters)==2 and letters.count(s[0])==2:
  print('Yes')
else:
  print('No')

Submission status: Wrong Answer

Solution code:
s = input()

letters = []
for i in range(4):
  if not s[0] in letters:
    letters.append(s[0])
  
if len(letters)==2 and letters.count(s[0])==2:
  print('Yes')
else:
  print('No')