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 = list(input())

sample = []

for moji in S:
  if moji not in sample:
    sample.append(moji)

total = 0
if len(sample) == 2:
  for letter in S:
    if sample[0] == letter:
      total += 1
  if total == 2:
    print('YES')
  else:
    print('NO')
else:
  print('NO')

Submission status: Wrong Answer

Solution code:
S = list(input())

sample = []

for moji in S:
  if moji not in sample:
    sample.append(moji)

if len(sample) == 2:
  print('YES')
else:
  print('NO')

Submission status: Wrong Answer

Solution code:
a, b, c, d = input()
if (a == b and c == d) or (a == c and b == d) or (a == d and b == c) :
    if not a==b==c==d:
        print("Yes")
    else:
        print("NO")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
a, b, c, d = input()
if (a == b and c == d) or (a == c and b == d) or (a == d and b == c) :
    if not a==b==c==d:
        print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
a, b, c, d = input()
if (a == b and c == d) or (a == c and b == d) or (a == d and b == c) and not a==b==c==d:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
a, b, c, d = input()
if (a == b and c == d) or (a == c and b == d) or (a == d and b == c):
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
# coding: utf-8
# Your code here!
s = input()
x = [s[i:i+1] for i in range(len(s))]

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:
S = list(map(str, input().split()))
check = 0

for i in range(len(S)):
  if S.count(S[i]) == 2:
    check += 1

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

Submission status: Wrong Answer

Solution code:
n= input()

n_list=list(n)

a=(n_list.count(n_list[0]))
b=(n_list.count(n_list[1]))
c=(n_list.count(n_list[2]))
d=(n_list.count(n_list[3]))
print(a,b,c,d)
if a==2:
    if b==2:
        if c==2:
            if d==2:
                print("Yes")
            else:
                print("No")
        else:
            print("No")
    else:
        print("No")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
n= input()

n_list=list(n)

a=(n_list.count(n_list[0]))
b=(n_list.count(n_list[1]))
c=(n_list.count(n_list[2]))
d=(n_list.count(n_list[3]))
if a and b and c and d==2:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
n= input()

n_list=list(n)

a=(n_list.count(n_list[0]))
b=(n_list.count(n_list[1]))
c=(n_list.count(n_list[2]))
if a and b and c ==2:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
n= input()

n_list=list(n)

a=(n_list.count(n_list[0]))
b=(n_list.count(n_list[1]))
c=(n_list.count(n_list[2]))
if a and b and c ==2:
    print("Yes")
else:("No")

Submission status: Wrong Answer

Solution code:
n= input()

n_list=list(n)

a=(n_list.count(n_list[0]))
b=(n_list.count(n_list[1]))
c=(n_list.count(n_list[0]))
if a and b and c ==2:
    print("Yes")
else:("No")

Submission status: Wrong Answer

Solution code:
S = set(input())
print('Yes' if len(S) == 2 else 'NO')

Submission status: Wrong Answer

Solution code:
S = set(list(input()))
print('Yes' if len(S) == 2 else 'NO')

Submission status: Wrong Answer

Solution code:
s=input()
if len(set(s))==2 and s.count(s[0])==2:                 
    print('YES')
else:
    print('NO')

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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


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()
error = 0
for i in S:
    if S.count(i)%2==1:
        print("No")
        error = 1
        break
if error==0:
    print("Yes")

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python
# -*- coding: utf-8 -*-

from collections import defaultdict


def is_valid(S):
    if len(S) != 4:
        return False

    counter = defaultdict(int)
    for c in S:
        if c.islower():
            return False
        else:
            counter[c] += 1

    if len(counter) == 2:
        for key in counter:
            if counter[key] != 2:
                return False

    return True


def main():
    S = input()
    valid = is_valid(S)
    if valid:
        print('Yes')
    else:
        print('No')


main()

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python
# -*- coding: utf-8 -*-

from collections import Counter


def is_valid(S):
    if len(S) != 4:
        return False

    counter = Counter(S)
    if len(counter) == 2:
        for key in counter:
            if counter[key] != 2:
                return False

    return True


def main():
    S = input()
    valid = is_valid(S)
    if valid:
        print('Yes')
    else:
        print('No')

main()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
S=str(input())
a=0
for i in S:
  if S.count(i)==2:
    a+=2
    
print('Yes' if a==4 else 'No')

Submission status: Wrong Answer

Solution code:
S=str(input())
L=[]
for i in range(4):
  L.append(S[i])
L.sort()
 
print('Yes' if L[0]==S[1] and L[2]==L[3] and L[0]!=L[2] else 'No')

Submission status: Wrong Answer

Solution code:
S=str(input())
L=[]
for i in range(4):
  L.append(S[i])
L.sort()
 
print('Yes' if L[0]==S[1] and L[2]==L[3] else '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()
Sflg1 = False
Sflg2 = False
i = 0
while i < 4:
    j = i + 1
    while j < 4:
        if S[i] == S[j]:
            if Sflg1 == False:
                Sflg1 = True
            else:
                Sflg2 = True
        j += 1
    i += 1

if Sflg1 == True and Sflg2 == True:
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

Solution code:
data = list(input())

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

Submission status: Wrong Answer

Solution code:
data = list(input())
types = len(list(set(data)))
flag = 'No'
for i in range(3):
    if data[i] == data[i + 1]:
        flag = 'Yes' if types == 2 else 'No'
        
print(flag)

Submission status: Wrong Answer

Solution code:
S = input()

if not sum(list(map(lambda x: x == S[0], S))) == 2:
  print('No')
else:
  s = S[1:]
  idx = s.index(S[0])

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

Submission status: Wrong Answer

Solution code:
s = input()
d = {}

for	c in s:
  if c in d:
    d[c] = d[c]+1
  else:
    d[c] = 0
    
if len(d.keys())==2 and all([v==2 for k,v in d.items()]):
  print('Yes')
else:
  print('No')

Submission status: Wrong Answer

Solution code:
from collections import Counter
A=input()
ele=Counter(A)
print("YES" if len(ele)==2 else "NO")

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())
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 = raw_input()
f = True

for i in S:
  if S.count(i) != 2:
    print "No"
    f = False
if f:
  print "Yes"
else:
  print "No"

Submission status: Wrong Answer

Solution code:
S = input()
Si = [0]*4

for i in range(0,4):
    Si[i] = S[i]

Si.sort()

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

Submission status: Wrong Answer

Solution code:
S = str(input())

for i in range(len(S)):
    if not(S.count(S[i])==2):
        print("No")
        break
    else:
        print("Yes")
        break

Submission status: Wrong Answer

Solution code:
def myInput():
  n = input()
  s = input()
  return (n, [int(i) for i in s.split()])

def func():
  n, lst = myInput()
  cnt = 0
  for i in range(1, int(n)-1):
    if min(lst[i+1], max(lst[i], lst[i-1])) == lst[i]:
      cnt+=1
    elif min(lst[i-1],max(lst[i],lst[i+1])) == lst[i]:
      cnt+=1
  return cnt

Submission status: Wrong Answer

Solution code:
S = str(input())

for i in range(len(S)-1):
    if not(S.count(S[i])==2):
        print("No")
        break
    else:
        print("Yes")
        break

Submission status: Wrong Answer

Solution code:
S = input()

count = 0
for i in range(4):
    for j in range(i+1, 4):
        if S[i] == S[j]:
            count += 1

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

Submission status: Wrong Answer

Solution code:
## AABB
## ABBA
## ABAB

S = input().strip()
first_char = ['', 0]
second_char = ['', 0]
counter = 0
ans = True
for c in S:
    if counter == 0:
        first_char[0] = c
        first_char[1] += 1
    
    if counter == 1:
        if c != first_char:
            second_char[0] = c
            second_char[1] += 1
        else:
            first_char[1] += 1
            
    if counter >1:
        if(first_char[0] != c and second_char[0] != c):
            ans = False
            break
        if c == first_char[0]:
            first_char[1] += 1
            if first_char[1] > 2:
                ans = False
                break
                
        if c == second_char[0]:
            second_char[1] += 1
            if second_char[1] > 2:
                ans = False
                break
    counter += 1

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

Submission status: Wrong Answer

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

con = True
for i in ss:
  con = False if ss.count(i) != 2 else True
if con:
  print("Yes")
else:
  print("No")

Submission status: Wrong Answer

Solution code:
def calc(text):
  unique = list(set(text))
  if len(unique) != 2:
    return "NO"

  if text.count(unique[0]) == 2:
    return "YES"
  else:
    return "NO"

text = input()
print(calc(text))

Submission status: Wrong Answer

Solution code:
a = list(input())
a.sort()
b = False
c = False
if a[0] == a[1]:
    b = True
if a[2] == a[3]:
    if a[2] != a[0]:
        c = True
print(b and c)

Submission status: Wrong Answer

Solution code:
a = list(input())
a.sort()
b = False
c = False
if a[0] == a[1]:
    b = True

if a[2] == a[3]:
    c = True
print(b and c)

Submission status: Wrong Answer

Solution code:
a,b,c,d=input()
kotae="NO"
kai=0
if (a==b and c==d):
        kotae="YES"
        kai+=1
if (a==c and b==d):
        kotae="YES"
        kai+=1
if (a==d and b==c):
        kotae="YES"
        kai+=1
if(kai!=1):
    kotae="NO"
print(kotae)

Submission status: Wrong Answer

Solution code:
S = input()
A = set (S)
B = len (A)
if B == 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] and s[1] != s[2]:
    print('Yes')

Submission status: Wrong Answer

Solution code:
s = input()

s = sorted(s)

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

Submission status: Wrong Answer

Solution code:
#４文字の文字列Sが二種類で2回ずつ現れる判定
S = input()
S_list = set(list(S))
print(S_list)




if len(S_list) == 2:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
S = input()

if 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]:
  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 = [0,0]

a1 = S[0]
a2 = "NUM"

if S[1] == a1:
    list1[0]=2
else:
    a2 = S[1]

if S[2]==a1:
    list1[0]=2
else:
    if S[1]==a1:
        a2 =S[2]
    else:
        if S[2]==a2:
            list1[1]=2
        else:
            pass

if S[3]==a1:
    list1[0]=2
else:
    if S[2]==a1 and S[1] == a1:
        a2 = S[3]
    else:
        if S[3]==a2:
            list1[1]=2
        else:
            pass

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

Submission status: Wrong Answer

Solution code:
S = input()

list1 = [0,0]

a1 = S[0]
a2 = "NUM"

if S[1] == a1:
    list1[0]=2
else:
    a2 = S[1]

if S[2]==a1:
    list1[0]=2
else:
    if S[1]==a1:
        a2 =S[2]
    else:
        if S[2]==a2:
            list1[1]=2
        else:
            pass

if S[3]==a1:
    list1[0]=2
else:
    if S[2]==a1:
        a2 = S[3]
    else:
        if S[3]==a2:
            list1[1]=2
        else:
            pass

if list1[1]==2 and list1[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[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.isupper() == True:
    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 = input()
a = (s[0] == s[1]) and (s[2] == s[3])
b = (s[0] == s[2]) and (s[1] == s[3])
c = (s[0] == s[3]) and (s[1] == s[2])
if a or b or c:
  print('Yes')
else:
  print('No')

Submission status: Wrong Answer

Solution code:
s = str(input())
c1 = "Init"
c2 = "Init"
ans = "Yes"
for i in s:
    if c1 == "Init":
        c1 = i
    elif c1 == i:
        continue
    elif c2 == "Init":
        c2 = i
    elif c2 == i:
        continue
    else:
        ans = "No"
print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

print(S)

s = set(S)
if len(s) == 2:
    count = 0
    for _ in s:
        if len([a for a in S if a == _]) == 2:
            print('Yes')
            quit()

print('No')

Submission status: Wrong Answer

Solution code:
s = input()
s_ = [i for i in s]

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(raw_input())
S.sort()
print "Yes" if S[0] == S[1] and S[2] == S[3] else "No"

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
S = input()

sorted_S = sorted(S)

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

Submission status: Wrong Answer

Solution code:
S = input()

sorted_S = sorted(S)

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

Submission status: Wrong Answer

Solution code:
s = input()
if s[0] == s[2] and s[1] == s[3] or s[0] == s[1] and s[2] == 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()
S=list(S)

for i in range(2):
    tmp=S[0]
    S.remove(tmp)
    try:
        S.remove(tmp)
    except ValueError:
        pass

if len(S) == 0:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
s = input()
d = dict()

for c in s:
    if c in d:
        d[c] += 1
    else:
        d[c] = 1
        
result = 'Yes'
for k in d:
    if d[k] != 2:
        result = 'N0'

print(result)

Submission status: Wrong Answer

Solution code:
s=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()
s = sorted(s) # list of sorted data

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

if s[0] == s[1] and s[2] == s[3] and s[0] != s[2]:
    print('yes')
elif s[0] == s[2] and s[1] == s[3] and s[0] != 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:
s = input()
t = list(s)[0]
s = s.replace(t, '', 2)
if(list(s)[0] != t):
    s = s.replace(t, '', 2)
if(len(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[0] !=s[2]:
    print('YES')
elif s[0] == s[2] and s[1] == s[3] and s[0] !=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:
L=input()
L_l=[]
for i in L:
     L_l.append(i)
L_l.sort()
if L_l[0]==L_l[1] and L_l[2]==L_l[3]:
     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[0] != s[2]:
    print('Yes')

Submission status: Wrong Answer

Solution code:
inputS = set(input())
if len(inputS):
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
S = set(input())
print(len(S))

Submission status: Wrong Answer

Solution code:
from collections import Counter

str = input().strip()

count = Counter(str)

if len(count):
    for v in count.values():
        if v == 2:
            print("Yes")
        else:
            print("No")
        
        break

Submission status: Wrong Answer

Solution code:
a = input()

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

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

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

else:
    print("No")

Submission status: Wrong Answer

Solution code:
a = input()

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

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

elif a[0] == a[3]:
    if a[1] == a[2]:
        print("Yes")

else:
    print("No")

Submission status: Wrong Answer

Solution code:
n = input()
l = list(set(n))
flag = 1
for i in l:
    if n.count(i) != 2:
        print("NO")
        flag = 0
        break
if flag ==1:
  print("YES")

Submission status: Wrong Answer

Solution code:
n = input()
l = list(set(n))
flag = 1
for i in l:
    if n.count(i) != 2:
        print("NO")
        flag = 0
if flag ==1:
  print("YES")

Submission status: Wrong Answer

Solution code:
n = input()
l = list(set(n))
flag = 1
for i in l:
    if n.count(i)%2 != 0:
        print("NO")
        flag = 0
if flag ==1:
  print("YES")

Submission status: Wrong Answer

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

import sys
tmp = input()

print(tmp)
if (tmp[0] == tmp[1]) and (tmp[2] == tmp[3]) and (tmp[1] != tmp[3]):
	print("Yes")
	sys.exit()
if (tmp[0] == tmp[2]) and (tmp[1] == tmp[3]) and (tmp[2] != tmp[3]):
	print("Yes")
	sys.exit()
if (tmp[0] == tmp[3]) and (tmp[2] == tmp[1]) and (tmp[1] != tmp[3]):
	print("Yes")
	sys.exit()
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()

list = []
num = []

for i in str:

    if len(list) is 0:
        list.append(i)
    else:
        if list.count(i) == 0:
                list.append(i)

print(list)

for i in list:
    num.append(str.count(i))

if len(num) is 2 and num[0]==2 and num[1]==2:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
S = input()
S1, S2, S3, S4 = map(str, list(S))

if S1==S2 and S3==S4:
  print("Yes")
elif S2==S3 and S1==S4:
  print("Yes")
elif S1==S3 and S2==S4:
  print("Yes")
else:
  print("No")

Submission status: Wrong Answer

Solution code:
S = input()
S1, S2, S3, S4 = map(str, list(S))

if S1==S2 and S3==S4:
  print("Yes")
elif S2 == S3 and S1==S4:
  print("Yes")
elif S1==S3 and S2==S4:
  print("Yes")
else:
  print("No")

Submission status: Wrong Answer

Solution code:
s = input()
ans = False
if s[0] == s[1] :
  if s[0] != s[2] and s[2] == s[3] :
    ans = True
elif s[0] == s[2] :
  if s[0] != s[1] and s[1] == s[3] :
    ans = True
elif s[0] == s[3] :
  if s[0] != s[1] and s[1] == s[2] :
    ans = True
if ans :
  print('Yse')
else:
  print('No')

Submission status: Wrong Answer

Solution code:
s = input()
ans = False
if s[0] == s[1] and s[2] == s[3] :
  ans = True
if s[0] == s[2] and s[1] == s[3] :
  ans = True
if s[0] == s[3] and s[1] == s[2] :
  ans = True
if ans :
  print('Yse')
else:
  print('No')

Submission status: Wrong Answer

Solution code:
s = input()
ans = False
if s[0] == s[1] and s[2] == s[3] :
  ans = True
if s[0] == s[2] and s[1] == s[3] :
  ans = True
if s[0] == s[3] and s[0] == s[2] :
  ans = True
if ans :
  print('Yse')
else:
  print('No')

Submission status: Wrong Answer

Solution code:
S=input()
hantei=False
if(len(set(S))==2):
    hantei=True
else:
    hantei=False
SS=sorted(S)
if(SS[0]==SS[1] and SS[0]!=SS[2]):
    hantei=True
else:
    hantei=False
if(hantei==True):
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
s = input()
word_list = []
for i in range(len(s)):
    word_list.append(s[i])
list = []
print(word_list)

for i in range(len(word_list)):
    flag = 0
    w = word_list[i]
    if len(list) == 0:
        list.append([w,1])
    else:
        for j in range(len(list)+1):
            if j == len(list) and flag == 0:
                list.append([w,1])
            elif j == len(list):
                continue
            elif list[j][0] == w:
                flag = 1
                list[j][1] = list[j][1] + 1

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

Submission status: Wrong Answer

Solution code:
if set(list(input()))==2:
  print('Yes')
else:
  print('No')

Submission status: Wrong Answer

Solution code:
l = list(input())

dic = {}
for i, v in enumerate(l):
    if v in dic:
        dic[v] += 1
    else:
        dic[v] = 1

print(dic)
li = list(dic.values())

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
l = list(input().split())

dic = {}
for i, v in enumerate(l):
    if v in dic:
        dic[v] += 1
    else:
        dic[v] = 1

li = list(dic.values())

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

Submission status: Wrong Answer

Solution code:
li = list(input())
li1 = li[:]

flag = 'No'
for i in range(1,4):
    if li[0]==li[i]:
        del li1[i],li1[0]
        if li1[0] == li1[1]:
            flag = 'Yes'
            break
        break

print(flag)

Submission status: Wrong Answer

Solution code:
li = list(input())
li1 = li[:]

flag = 'No'
for i in range(1,4):
    if li[0]==li[i]:
        del li1[i],li1[0]
        if li1[0] == li1[1]:
            flag = 'Yes'
            break

print(flag)

Submission status: Wrong Answer

Solution code:
s = [n for n in input()];r = len(set(s)) == 2 and (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" if r else "No")

Submission status: Wrong Answer

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

def fifty_fifty(word):
    r = {}
    for s in list(word):
        if s in r:
            r[s] += 1
        else:
            r[s] = 1
    if len(r) == 2 and max(r.values()) == 2:
        return 'yes'
    else:
        return 'no'

s = input()
print(fifty_fifty(s))

Submission status: Wrong Answer

Solution code:
s = [n for n in input()];r = ((len(set(s)) == 2) and (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" if r else "No")

Submission status: Wrong Answer

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

def fifty_fifty(word):
    r = {}
    for s in list(word):
        if s in r:
            r[s] += 1
        else:
            r[s] = 1
    if len(r) <= 2 and max(r.values()) % 2 == 0:
        return 'yes'
    else:
        return 'no'

s = input()
print(fifty_fifty(s))

Submission status: Wrong Answer

Solution code:
s = [n for n in input()];r = len(set(s)) == 2 and (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" if r else "No")

Submission status: Wrong Answer

Solution code:
s = [n for n in input()];r = len(set(s)) and (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" if r else "No")

Submission status: Wrong Answer

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

def fifty_fifty(word):
    r = {}
    for s in list(word):
        if s in r:
            r[s] += 1
        else:
            r[s] = 1
    if len(r) <= 2 and max(r.values()) % 2 == 0:
        return 'yes'
    else:
        return 'no'

if __name__ == "__main__":
    s = input()
    print(fifty_fifty(s))

Submission status: Wrong Answer

Solution code:
s = [n for n in input()];r = (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" if r else "No")

Submission status: Wrong Answer

Solution code:
s = list(input())

line = set(s)

if len(s) == 2:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
txt = input()
list = list(txt)
a = list[0]
b = list[1]
c = list[2]
d = list[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()

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

Submission status: Wrong Answer

Solution code:
def main():
    s = list(raw_input())
    flag = False
    if s[0] == s[1] and s[2] == s[3]:
        if s[0] != s[2]:
            flag = True
    elif s[0] == s[3] and s[1] == s[2]:
        if s[0] != s[1]:
            flag = True
    if flag == True:
        print("Yes")
    else:
        print("No")
if __name__ == "__main__":
    main()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import sys

s = list(input())

while len(s) > 0:
    letter = s[0]
    del s[0]
    try:
        idx = s.index(letter)
        del s[idx]
    except:
        print('No')
        sys.exit()
else:
    print('Yes')

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
S = input()

l = list(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()
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]:
  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]:
  print("YES")
elif s[0]==s[2] and s[1]==s[3]:
  print("YES")
elif s[0]==s[3] and s[2]==s[3]:
  print("YES")
else:
  print("NO")

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
sti = input()
up,down = False,False
for i in sti:
    if i == i.upper():
        up = True
    else:
        down = True
if up and down:
    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")