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()
S=str(S)

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

a = []
for i in s:
    a.append(i)

cnt1 = 0
cnt2 = 0
memo =24
for i in range(1,4):
    if a[0] == a[i]:
        memo = i
        break;
    

ans = "No"
if(memo != 24):
    for i in range(1,4):
        for j in range(i,4):
            if (i != memo and j != memo):
                if a[i] == a[j]:
                    if a[0] != a[i]:
                        ans = "Yes"
                        break;


print(ans)

Submission status: Wrong Answer

Solution code:

print('hello')

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
# 整数の入力
p=str(input())
if p[0] ==p[3] and p[1] == p[2]:
    print("Yes")
elif p[0] == p[1] and p[2] == p[3]:
    print("Yes")
elif p[0] ==p[1] ==p[2] ==p[3]:
    print("No") 
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]:
  if s[0] == s[1]:
    if s[2] == s[3]:
      print("Yes")
  elif  s[0] != s[1]:
    if s[1] == s[2]:
      print("Yes")
    elif  s[1] == s[3]:
      print("Yes")

else:
  print("No")

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
# 整数の入力
p=str(input())
if p[0] ==p[3] and p[1] == p[2]:
    print("Yes")
elif p[0] == p[1] and p[2] == p[3]:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
# 整数の入力
p=str(input())
if p[0] ==p[3] and p[1] == p[2]:
    print("YES")
elif p[0] == p[1] and p[2] == p[3]:
    print("YES")
else:
    print("NO")

Submission status: Wrong Answer

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

if(a==b or a==c or a==d):
    count+=1

if(b==c or b==d or c==d):
    count+=1

if(count==2):
    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]:
  if s[0] == s[1]:
    if s[2] == s[3]:
      print("Yes")
  elif  s[0] != s[1]:
    if s[1] == s[2]:
      print("Yes")

else:
  print("No")

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
s = str(input())
for i in s:
    if s.count(i) != 2:
        print('No')
print('Yes')

Submission status: Wrong Answer

Solution code:
S = input()
ans = 0

for i in range(3):
    if S[i] == S[i + 1]:
        ans += 1

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

Submission status: Wrong Answer

Solution code:
S = input()
c1=0
c2=0
c3=0
a = S[0]
b = S[1]
c = S[2]
for i in S[3:]:
    if i == a:
        c1 +=1
    elif i == b:
        c2 +=1
    elif i == c:
        c3 +=1
if c3==1 or (c1 == 1 and c2 == 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:
n = input()

cnt = 0
if n.count(n[0]) == 2:
  cnt += 1
if n.count(n[1]) == 2:
  cnt += 1
if n.count(n[2]) == 2:
  cnt += 1
if n.count(n[3]) == 2:
  cnt += 1

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

Submission status: Wrong Answer

Solution code:
S = str(input())

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

Submission status: Wrong Answer

Solution code:
S = input()
c1=0
c2=0
c3=0
a = S[0]
b = S[1]
c = S[2]
for i in S[2:]:
    if i == a:
        c1 +=1
    elif i == b:
        c2 +=1
    elif i == c:
        c3 +=1

if c3==1 or (c1 == 1 and c2 == 1):
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
S = str(input())

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

Submission status: Wrong Answer

Solution code:
z = input()
char_list = list(z)
if(len(char_list) == 4 ):
    t = 0
    for char in char_list :        
        if(char_list.count(char) != 2):            
            print("No")
            break
        else:
            t = t + 1                
    if(t == 4):
        print("YES")
else:
    print("No")

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import collections
x=input()
y=[x[0],x[1],x[2],x[3]]
c = collections.Counter(y)
ans="Yes"
if(len(c))>3:
    ans="No"
if(ans=="Yes"):

    a=x.count(x[0])
    if(a>2):
        ans="No"



print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
s = input()
c1 = s[0]
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())
count = 0
s_1 = s[0]
for i in range(3):
    if s_1 == s[i+1]:
        del(s[i+1])
        break

del(s[0])
if len(s) == 3:
    print('No')

if len(s) == 2:
    if s[0] == s[1]:
        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:
  if c == d and a != c:
    print("Yes")
  else:
    print("No")
if a == c:
  if b == d and a != b:
    print("Yes")
  else:
    print("No")
if a == d:
  if b == c and a != b:
    print("Yes")
  else:
    print("No")
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] == 2 and c.most_common()[1][1] == 2:
        print("Yes")
else:
        print("No")

Submission status: Wrong Answer

Solution code:
S = input()
Slen = len(S)
cnt=[0,0,0]
flg = True
for i in range(Slen-1):
  
  for j in range(Slen):
    if S[i]==S[j]:
      cnt[i] += 1
  
  print(i,cnt[i])
  if cnt[i] < 2 or cnt[i] > 2:
    flg = False
    print(flg)
    break

if flg == True:
  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:
  if c == d and a != c:
    print("Yes")
  else:
    print("No")
if a == c:
  if b == d and a != b:
    print("Yes")
  else:
    print("No")
if a == d:
  if b == c and a != b:
    print("Yes")
  else:
    print("No")

Submission status: Wrong Answer

Solution code:
ns = input()

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

Submission status: Wrong Answer

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

from sys import stdin

N = [ x for x in stdin.readline().rstrip()]

flg = 0

for i in range(4):
    for j in range(i+1,4):
        if N[i] == N[j]:
            del N[j]
            del N[i]
            flg = 1
            break

    if flg == 1:
        break

if flg == 1 and N[0] == N[1]:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
s = input()

a = []
for i in s:
    a.append(i)

cnt1 = 0
cnt2 = 0
memo =24
for i in range(1,4):
    if a[0] == a[i]:
        memo = i
        break;
    

ans = "No"
if(memo != 24):
    for i in range(1,4):
        for j in range(1,4):
            if (i != memo and j != memo):
                if a[i] == a[j]:
                    if a[0] != a[i]:
                        ans = "Yes"
                        break;


print(ans)

Submission status: Wrong Answer

Solution code:
import sys

str = str(input())
list = []
for c in str:
  list.append(c)
list.sort()
if list[0] == list[2]:
    print("No")
    sys.exit()
if list[0] == list[1]:
  if list[2] == list[3]:
    print("Yes")
    sys.exit()
else:
  print("No")

Submission status: Wrong Answer

Solution code:
s=input()
a=s[0]
b=s[1]
if a==b and a!=s[2]:
  a=s[2]
  b=s[3]
  if a==b:
    print("Yes")
elif a!=b and a==s[2] and b==s[3]:
  print("Yes")
elif a!=b and a==s[3] and b==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().split()
t=set(s)
if len(t)==2:
  if s.count(list(t)[0])==2:
    print('Yes')
  else:
    print('No')
else:
  print('No')

Submission status: Wrong Answer

Solution code:
a = input()

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

Submission status: Wrong Answer

Solution code:
a = input()
b = list(a)
b.sort()
Judge = True
if b[0] == b[1]:
    Judge = True
else:
    Judge = False
if b[1] != b[2]:
    Judge = True
else:
    Judge = False
if b[2] == b[3]:
    Judge = True
else:
    Judge = False
if Judge == True:
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

Solution code:
def main():
    a= input()
    print(a)

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


if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
a = input()

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

Submission status: Wrong Answer

Solution code:
S=input()

if len(S)!=4:
  print('No')
else:  
  Sorted_S = sorted(S)
  
  L1=Sorted_S[0]
  L2=Sorted_S[1]
  L3=Sorted_S[2]
  L4=Sorted_S[3]

  if (L1==L2) and (L3==L4):
    print("Yes")
  else:
    print("No")

Submission status: Wrong Answer

Solution code:
S=input()
count=0
first=False
OK=False
memo=S[0]
for i in range(4):    
    if S[i]==S[0]:
        count+=1
    elif (S[i]!=S[0] and first==False):
        memo=S[i]
        first=True
        print(memo)

    elif (S[i]!=S[0] and first==True):
        if S[i]==memo:
            OK=True

print(count)
print(memo)

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

Submission status: Wrong Answer

Solution code:
input_data= input()
dic={}
yes_flag= 0

for moji in input_data:
  try:
    dic[moji] = dic[moji] + 1
  except KeyError:
    dic[moji] = 1


for keys in dic:
  if dic[keys] == 2:
    yes_flag = 1

if yes_flag == 1:
  print('Yes')
else:
  print('No')

Submission status: Wrong Answer

Solution code:
S = input()

judge=0
pair=0

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

if(pair==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[1]==S[2] and  S[0]==S[3]:
        print('Yes')
        
elif S[1]==S[3] and  S[0]==S[2]:
        print('Yes')

elif S[1]==S[2]==S[3]==S[0]:
        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]:
        print("YES")
        exit()
    if S[0] == S[2] and S[1] == S[3]:
        print("YES")
        exit()
    if S[0] == S[3] and S[1] == S[2]:
        print("YES")
        exit()
print("NO")

Submission status: Wrong Answer

Solution code:
S=input()
count=0
first=False
OK=False
memo=S[0]
for i in range(4):    
    if S[i]==S[0]:
        count+=1
    elif (S[i]!=S[0] and first==False):
        memo=S[i]
        first=True
        print(memo)

    elif (S[i]!=S[0] and first==True):
        if S[i]==memo:
            OK=True

print(count)
print(memo)

if (count==2 and OK==True):
    print("Yes")
else:
    print("NO")

Submission status: Wrong Answer

Solution code:
S = input()

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

Submission status: Wrong Answer

Solution code:
n = input()

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

Submission status: Wrong Answer

Solution code:
import sys

str = str(input())

if str[0] == str[1]:
  if str[2] == str[3]:
    print("Yes")
    sys.exit()
if str[0] == str[2]:
  if str[1] == str[3]:
    print("Yes")
    sys.exit()
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 = str(input())
adic = {}

for i in range(4):
  if not s[i] in adic:
    adic[s[i]] = 1
  else:
    adic[s[i]] += 1
    
abool = True
if len(adic) == 2:
  for item in adic:
    if adic.get(item) != 2:
      abool = False
else:
  abool = False
  
if abool:
  print('YES')
else:
  print('NO')

Submission status: Wrong Answer

Solution code:
S = input()
x = [str(i) for i in str(S)]
a = x[0]
b = x[1]
c = x[2]
d = x[3]
if a == b and c == d: 
    print('Yes')
elif b == c and a == d:
    print('Yes')
elif a == c and b == d:
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

Solution code:
import collections
s = input()
s = list(s)
s.sort()
count = 0
ans = collections.Counter(s)
ans = len(ans)
if ans == 2:
    print("YES")
else:
    print("NO")

Submission status: Wrong Answer

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

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] and S[2]==S[3]:
        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')

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:
def count_cap(S):
    renso={"A":0,"B":0,"C":0,"D":0,"E":0,"F":0,"G":0,"H":0,"I":0,"J":0,"K":0,"L":0,"M":0,"N":0,
          "O":0,"P":0,"Q":0,"R":0,"S":0,"T":0,"U":0,"V":0,"W":0,"X":0,"Y":0,"Z":0}
    count = 0
    for a in S:
        if renso[a] == 1:
            count = count + 1
        renso[a] = renso[a]+1
    
    if count == 2:
        return "yes"
    else:
        return "no"

print(count_cap(input()))

Submission status: Wrong Answer

Solution code:
in_str = input()
ok = 0
if in_str[0] == in_str[1]:
  if in_str[2] == in_str[3]:
    print("Yes")
    ok += 1
elif in_str[0] == in_str[2]:
  if in_str[1] == in_str[3]:
    print("Yes")
    ok += 1
elif in_str[0] == in_str[3]:
  if in_str[1] == in_str[2]:
    print("Yes")
    ok+= 1
if(ok != 1):
  print("No")

Submission status: Wrong Answer

Solution code:
s = list(input())
if len(s) != 4:
    print('No')
if s[0] == s[1] and s[2] == s[3]:
    print('Yes')
    exit()
if s[0] == s[2] and s[1] == s[3]:
    print('Yes')
    exit()
if s[0] == s[3] and s[1] == s[2]:
    print('Yes')
    exit()
print('No')

Submission status: Wrong Answer

Solution code:
str = input()

char_count = 1
for i in range(3):
    if str[0] == str[i+1]:
        char_count += 1
    else:
        char2 = i+1
        char2_count = 0
        
if char_count == 2:
    for char in str:
        if str[char2] == char:
            char2_count += 1
            
    if char2_count == 2:
        print("Yes")
        
    else:
        print("No")
        
else:
    ("No")

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
a = list(input())
before = -1
count =0
for char in a:
    current = char
    if before == current:
        count = count+1
    else:
        before = current

if count==2:
    s = set()
    for item in a:
        s.add(item)
    if len(s) == 2:
        print("Yes")
        exit()

print("No")

Submission status: Wrong Answer

Solution code:
import collections
s = input()
s = list(s)
s.sort()
count = 0
ans = collections.Counter(s)
if ans == 2:
    print("YES")
else:
    print("NO")

Submission status: Wrong Answer

Solution code:
# coding: utf-8
# Your code here!

n = input()
a1 = n[0]
a2 = n[0]
count1 = 1
count2 = 0
for nc in range(1,4):
    if(n[nc] == a1):
        count1 += 1
    elif(a1 == a2):
        a2 = n[nc]
        count2 += 1
    elif(n[nc] == a2):
        count2 += 1
if(count1 == count2):
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
S=input().upper()

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:
in_str = input()
ok = 0
if in_str[0] == in_str[1]:
  if in_str[2] == in_str[3]:
    print("Yes")
    ok += 1
elif in_str[0] == in_str[2]:
  if in_str[1] == in_str[3]:
    print("Yes")
    ok += 1
elif in_str[0] == in_str[3]:
  if in_str[1] == in_str[2]:
    print("Yes")
    ok+= 1
if(ok == 0):
  print("No")

Submission status: Wrong Answer

Solution code:
import sys
input = sys.stdin.readline
#-------------------------------------
import collections

s = list(input())

c = collections.Counter(s)
print(c)

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

str = str(input())

for i in range(3):
  latter = str[i]
  counter = str.count(latter)
  #print(latter)
  #print(counter)
  if counter >= 2:
    print("Yes")
    sys.exit()

print("No")

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
a = list(input())
before = -1
flag = False
for char in a:
    current = char
    if before == current:
        flag = True
    else:
        before = current

if flag:
    s = set()
    for item in a:
        s.add(item)
    if len(s) == 2:
        print("Yes")
        exit()

print("No")

Submission status: Wrong Answer

Solution code:
s = input()
s_s = list(set(s))

print(s_s)

if len(s_s) == 2:
  if s.count(s_s[0]) == s.count(s_s[1]):
    print("Yes")
else:
    print('No')

Submission status: Wrong Answer

Solution code:
s = list(input())

for i in s[1:]:
    if s[0] == i:
        s.remove(i)
        s.remove(i)
        break

if len(s) == 4:
    print("No")

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

Submission status: Wrong Answer

Solution code:
A,B,C,D = input()
S = (A+B+C+D)
S1 = S.strip(A)

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

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
S = str(input())
s_list = []
for s in S:
    if s in s_list:
        s_list.remove(s)
    else:
        s_list.append(s)
        
if len(s_list) == 0:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
S= input().split()  

count=0

for i in S:
    for j in S:
        if i==j:
            count+=1

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

Submission status: Wrong Answer

Solution code:

S=input()
count=0
first=False
OK=True
memo=S[0]
for i in range(4):
    if S[i]==S[0]:
        count+=1
    elif (not S[i]==S[0] and first==False):
        memo==S[i]
        first==True
    elif(not S[i]==S[0] and first==True):
        if S[i]==memo:
            OK==True

if (count==2 and OK==True):
    print("Yes")
else:
    print("NO")

Submission status: Wrong Answer

Solution code:
a = list(input())
before = -1
flag = False
for char in a:
    current = char
    if before == current:
        flag = True
    else:
        before = current

if flag:
    s = set()
    for item in a:
        s.add(item)
    if len(s) <= 2:
        print("Yes")
        exit()

print("No")

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
S = input()
SS = list(S)
boo = False
boo2 = False
s1 = S[0]
s2 = S[1]
s3 = S[2]
s4 = S[3]
if s1 == s2:
    SS.pop(1)
    SS.pop(0)
elif s1 == s3:
    SS.pop(2)
    SS.pop(0)
elif  s1 == s4:
    SS.pop(3)
    SS.pop(0)
elif s2 == s3:
    SS.pop(2)
    SS.pop(1)
elif s2 == s4:
    SS.pop(3)
    SS.pop(1)
elif s3 == s4:
    SS.pop(3)
    SS.pop(2)
    
if len(SS) == 4:
    print("No")
elif SS[0] == SS[1]:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
s = input()
s_s = list(set(s))

print(s_s)

if len(s_s) >= 3 or len(s_s) == 1:
  print("No")
else:
  if s.count(s_s[0]) == s.count(s_s[1]):
    print("Yes")
  else:
    print("No")

Submission status: Wrong Answer

Solution code:
A,B,C,D = input()
S = (A+B+C+D)
S1 = S.strip(A)

if S1 !='':
    if S1[0] == S1[1]:
        print('Yes')
        exit()
print('No')

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import collections

s = input()
c = collections.Counter(s)
if len(c) == 2 and c[s[0]] == 2:
    print('YES')
else:
    print('NO')

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
S = input()
SS = list(S)
print(S)
boo = False
boo2 = False
s1 = S[0]
s2 = S[1]
s3 = S[2]
s4 = S[3]
if s1 == s2:
    SS.pop(1)
    SS.pop(0)
elif s1 == s3:
    SS.pop(2)
    SS.pop(0)
elif  s1 == s4:
    SS.pop(3)
    SS.pop(0)
elif s2 == s3:
    SS.pop(2)
    SS.pop(1)
elif s2 == s4:
    SS.pop(3)
    SS.pop(1)
elif s3 == s4:
    SS.pop(3)
    SS.pop(2)
    
if len(SS) == 4:
    print("No")
elif SS[0] == SS[1]:
    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()
count1=0
count2=0

char1=s[0]
char2='1'
count1+=1
if s[1]==char1:
    count1+=1
else :
    char2=s[1]
    count2+=1

if s[2]==char1:
    count1+=1
elif '1'==char2:
    char2=s[2]
    count2+=1

if s[3]==char1:
    count1+=1
elif '1'==char2:
    char2=s[3]
    count2+=1
elif s[3]==char2:
    count2+=1

if count1==2 and count2==2:
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

Solution code:
S=input()
s=list(S)
count=0
if s[0]==s[1]:
    count+=1
if s[1]==s[2]:
    count+=1
if s[0]==s[2]:
    count+=1
if s[2]==s[3]:
    count+=1
if s[3]==s[0]:
    count+=1
if s[3]==s[1]:
    count+=1
if count==2:
    print("YES")
else:
    print("NO")

Submission status: Wrong Answer

Solution code:
#coding:utf-8

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:
def main():
    s = list(input())
    s_unq = list(set(s))

    if len(s) == 2:
        if s.count(s_unq[0]) == 2 and s.count(s_unq[1]):
            print("Yes")
    else:
        print("No")
        
main()

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:
	if s.count(list[0]) == 2:
		print('Yes')
	else:
		print('no')
else:
	print('no')

Submission status: Wrong Answer

Solution code:
l = input()
a = l[0]
b = l[1]
c = l[2]
d = l[3]

for i in range(1,2):
    if(a==b and c==d):
        print("Yes")
        break
    if(a==c and b==d):
        print("Yes")
        break
    if(a==d and c==b):
        print("Yes")
        break
    print("No")

Submission status: Wrong Answer

Solution code:
text = input()

text1 = text.strip(text[0])
text2 = text1.strip(text[0])

if len(text) == 4 and len(text1) == 2 and len(text2) == 0:
  print("Yes")
else:
  print("No")

Submission status: Wrong Answer

Solution code:
x = input()
chars = list(x)
a = ord(chars[0])
b = ord(chars[1])
c = ord(chars[2])
d = ord(chars[3])
if (a==b and c==d and a!=c) or (a==c and b==d and a!=b) or (a==d and b==c and a!=b):
  print("yes")
else:
  print("no")

Submission status: Wrong Answer

Solution code:
import sys


S = [str(s) for s in input()]

s_dic = {}
for s in S:
    if s in s_dic.keys():
        s_dic[s] += 1
    else:
        s_dic[s] = 1


for i in s_dic.values():
    if int(i) != 2:
        print("NO")
        sys.exit()

print("YES")

Submission status: Wrong Answer

Solution code:
def li():
    return list(map(int, input().split()))


if __name__ == "__main__":
    s = input()
    a = s[0]
    b = ""
    found_a = False
    found_b = False
    for si in s[1:]:
        if si != a:
            if si != b:
                b = si
            found_b = True
        else:
            found_a = True

    if found_a and found_b:
        print("Yes")
    else:
        print("No")

Submission status: Wrong Answer

Solution code:
S = input()
ls = []
for i in S:
    ls.append(i)
a = set(ls)
if len(a) >=3:
    print("No")
elif ls[0] == ls[1] or ls[1] == ls[2] or ls[2] == ls[3]:
    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")
elif str.count(str[0])==2 and str.count(str[2])==2:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
text = input()

text1 = text.strip(text[0])
text2 = text.strip(text[0])

if len(text) == 4 and len(text1) == 2 and len(text2) == 0:
  print("Yes")
else:
  print("No")

Submission status: Wrong Answer

Solution code:
def main():
    s = list(input())
    s_unq = list(set(s))

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

main()

Submission status: Wrong Answer

Solution code:
from collections import defaultdict

sent = input()
w_count = defaultdict(int)

for i in range(len(sent)):
    w_count[sent[i]] += 1

if len(set(list(w_count.values()))) == 1:
    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] == 2:
        print("Yes")
else:
        print("No")

Submission status: Wrong Answer

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