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 = str(input())
s0 = s[0]
print(s[2:4])
if s0 == s[1]:
    if s[2] == s[3] and s[2] != s0:
        print('Yes')
    else:
        print('No')
else:
    s1 = s[1]
    if s1 in s[2:4] and s0 in s[2:4]:
        print('Yes')
    else:
        print('No')

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:

S = list(input().split()[0])


S_0 = S[0]
del S[0]
for i in range(0,3):
    if S[i] == S_0:
        del S[i]
        break
S_1 = S[0]
del S[0]
if S[0] == S_1:
    del S[0]
if len(S) == 0:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
S = input()

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
s = input()
data = dict()
for c in s:
    if c not in data:
        data[c] = 1
    else:
        data[c] = data[c] + 1
ans = True
for d in data:
    if data[d] != 2:
        ans = False
print(ans and len(data) == 2)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
S=input()

if S[1]==S[0]:
    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 = list(input())
a = [chr(i) for i in range(65, 65+26)]
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()
count = []

for i in s : count.append(i)
count.sort()

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

Submission status: Wrong Answer

Solution code:
N = str(input())
v = [N[i: i+1] for i in range(0, len(N), 1)]
v.sort()
if(v[0]==v[1] and v[2]==v[3]):
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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


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


if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
s = input()

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

Submission status: Wrong Answer

Solution code:
S = input()

ans = "No"
s = []

for _ in S:
    s.append(_)

s.sort()
if s[0] == s[1]:
    if s[2] == s[3]:
        ans = "Yes"

print(ans)

Submission status: Wrong Answer

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

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

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
import sys
input = sys.stdin.readline

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')
elif(( s[0]==s[1] and s[1]==s[2] and s[0]!=s[3] ) or ( s[0]==s[1] and s[1]==s[3] and s[0]!=s[2] ) or ( s[0]==s[2] and s[0]==s[3] and s[0]!=s[1] ) or ( s[1]==s[2] and s[1]==s[3] and s[0]!=s[1] )):
    print('No')

Submission status: Wrong Answer

Solution code:
import sys
from fractions import gcd
from collections import defaultdict
sys.setrecursionlimit(10**7)
INF = 10 ** 18
MOD = 10 ** 9 + 7
def LI(): return list(map(int, sys.stdin.readline().split()))
def II(): return int(sys.stdin.readline())
def LS(): return list(map(list, sys.stdin.readline().split()))
def S(): return list(sys.stdin.readline())

def main():
    s = S()
    d = defaultdict(int)
    for i in range(4):
        d[s[i]] += 1
    if len(d) == 2:
        for v in d.values():
            if v != 2:
                break
        else:
            print("YES")
            return
    print("BAD")



if __name__ == "__main__":
    main()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
s = input()

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
S = input()
if S[1] == S[0]:
	if S[2] == S[3]:
		print("Yes")
	else:
		print("No")
elif S[2] == S[0]:
	if S[1] == S[3]:
		print("Yes")
	else:
		print("No")
elif S[3] == S[0]:
	if S[1] == S[2]:
		print("Yes")
	else:
		print("No")
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()                       
   
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:
# N = list(map(int, input().split()))

S = input()
a = list(S)

a.sort()

# print(a)

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
S=input()

s1=S[0]
nc=0
for i,st in enumerate(S[1:]):
    if s1==st:
        nc+=1
        it=i
        
if nc==1:
    if it==0:
        if S[2]==S[3]:
            print('Yes')
    if it==1:
        if S[1]==S[3]:
            print('Yes')
  
    if it==2:
        if S[1]==S[2]:
            print('Yes')
    

else:
   print('No')

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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


if __name__ == '__main__':
    main()

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:
def main():
    S = input()
    if S[0] == S[1] and S[2] == S[3]:
        ans = "Yes"
    elif S[0] == S[2] and S[1] == S[3]:
        ans = "Yes"
    elif S[0] == S[3] and S[1] == S[2]:
        ans = "Yes"
    else:
        ans = "No"
    print(ans)


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
a=""
b=[]
a=input()
for x in a:
    b.append(x)

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

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python
from __future__ import division, print_function

import os
import sys
from collections import Counter
from io import BytesIO, IOBase

if sys.version_info[0] < 3:
    from __builtin__ import xrange as range
    from future_builtins import ascii, filter, hex, map, oct, zip


def main():
    s = Counter(input()).values()
    print('YES' if s == [2, 2] else 'NO')


# region fastio

BUFSIZE = 8192


class FastIO(IOBase):
    newlines = 0

    def __init__(self, file):
        self._fd = file.fileno()
        self.buffer = BytesIO()
        self.writable = "x" in file.mode or "r" not in file.mode
        self.write = self.buffer.write if self.writable else None

    def read(self):
        while True:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            if not b:
                break
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines = 0
        return self.buffer.read()

    def readline(self):
        while self.newlines == 0:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            self.newlines = b.count(b"\n") + (not b)
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines -= 1
        return self.buffer.readline()

    def flush(self):
        if self.writable:
            os.write(self._fd, self.buffer.getvalue())
            self.buffer.truncate(0), self.buffer.seek(0)


class IOWrapper(IOBase):
    def __init__(self, file):
        self.buffer = FastIO(file)
        self.flush = self.buffer.flush
        self.writable = self.buffer.writable
        self.write = lambda s: self.buffer.write(s.encode("ascii"))
        self.read = lambda: self.buffer.read().decode("ascii")
        self.readline = lambda: self.buffer.readline().decode("ascii")


def print(*args, **kwargs):
    """Prints the values to a stream, or to sys.stdout by default."""
    sep, file = kwargs.pop("sep", " "), kwargs.pop("file", sys.stdout)
    at_start = True
    for x in args:
        if not at_start:
            file.write(sep)
        file.write(str(x))
        at_start = False
    file.write(kwargs.pop("end", "\n"))
    if kwargs.pop("flush", False):
        file.flush()


if sys.version_info[0] < 3:
    sys.stdin, sys.stdout = FastIO(sys.stdin), FastIO(sys.stdout)
else:
    sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)

input = lambda: sys.stdin.readline().rstrip("\r\n")

# endregion

if __name__ == "__main__":
    main()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
word = list(input())

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
s = list(str(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()

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

print(d)
if len(d.keys()) == 2:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
s = input()

s = sorted(s)

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

Submission status: Wrong Answer

Solution code:
S = input()

condition = 0
for s in S:
  condition += S.count(s) != 2

if condition:
  answer = 'NO'
else:
  answer = 'Yes'

print(answer)

Submission status: Wrong Answer

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

# input
S = list(input())

# solve
S = sorted(S)
ans = 'Yes' if S[0] == S[1] and S[2] == S[3] else 'No'

# output
print(ans)

Submission status: Wrong Answer

Solution code:
S = input()
list1 = list(S)
#例えば4つ
a = list1[0]
b = list1[1]
c = list1[2]
d = list1[3]

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

Submission status: Wrong Answer

Solution code:
s=input()
f=0
for i in range(4):
  if s.count(s[i]) != 4:
    f=1
    print("No")
if f==0:
  print("Yes")

Submission status: Wrong Answer

Solution code:
s=input().split()
t=set(s)
if len(t)==2:
  if s.count(t[0])==2:
    print('Yes')
  else:
    print('No')
else:
  print('No')

Submission status: Wrong Answer

Solution code:
a = input()
b = 0
c = 0
for i in range(4):
    if a.count(a[i]) == 2:
        b += 1
for j in range(3):
    if a[j] == a[j+1]:
        c = 1
        break
if (b == 4)&(c == 1):
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
s = str(input())
s0 = s[0]
if s0 == s[1]:
    if s[2] == s[3]:
        print('Yes')
    else:
        print('No')
else:
    s1 = s[1]
    if s1 in s[2:4] and s0 in s[2:4]:
        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())
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 = list(input())

cnt = [1,0,0,0]


if(S[1] == S[0]):
    cnt[0] += 1
else:
    cnt[1] += 1

if(S[2] == S[0]):
    cnt[0] += 1
elif(S[2] == S[1]):
    cnt[1] += 1
else:
    cnt[2] += 1

if(S[3] == S[0]):
    cnt[0] += 1
elif(S[3] == S[1]):
    cnt[1] += 1
elif(S[3] == S[2]):
    cnt[2] += 1
else:
    cnt[3] += 1

if(cnt == [2,2,0,0]):
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

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

s = list(input())

F = 0
l = []

for i in s:
    if i in l:
        l.remove(i)
    else:
        l.append(i)
if l == []:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
S = list(input())
S1 = sorted(S)

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

Submission status: Wrong Answer

Solution code:
S = input()

T = sorted(S)
if T[0] == T[1] and T[2] == T[3] and T[1] != T[2]:
    print("Yes")
else:
    print("NO")

Submission status: Wrong Answer

Solution code:
s = str(input())

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

Submission status: Wrong Answer

Solution code:
S = input()
judge = "No"
for i in range(len(S)):
    if S[0] == S[1] and S[2] == S[3]:
        judge = "Yes"
    elif S[0] == S[2] and S[1] == S[3]:
        judge = "Yes"
    elif S[0] == S[3] and S[1] == S[2]:
        judge = "Yes"
print(judge)

Submission status: Wrong Answer

Solution code:

word = input()

#print(word[0])
if(word[0]==word[1]):
    if(word[2]==word[3]):
        print("Yes")

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

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

else:
    print("No")

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
import sys
import collections

def main():
	#A, B, Q = map(int, input().split(" "))
	S = input()
	
	tmp = S[0]
	tmp2 = S[1]
	tmp3 = S[2]
	tmp4 = S[3]
	
	if tmp == tmp2 and tmp3 == tmp4:
		print("Yes")
	elif tmp2 == tmp3 and tmp == tmp4:
		print("Yes")
	elif tmp == tmp3 and tmp2 == tmp4:
		print("Yes")
	else:
		print("No")
	
		
	
	
if __name__ == "__main__":
	main()

Submission status: Wrong Answer

Solution code:
S = list(input())

count1 = S.count(S[0])
count2 = S.count(S[1])

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

Submission status: Wrong Answer

Solution code:
s=input()

a=s[0]
b=''
for i in range(1,4):
  if s[i]!=b:
    b=s[i]
ca=0
cb=0
for i in range(4):
  if s[i]!=a and s[i]!=b:
    print('No')
    exit()
  if s[i]==a:
    ca+=1
  elif s[i]==b:
    cb+=1
if ca==2 and cb==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")
if s[0] == s[2]:
    if s[1] == s[3]:
        print("Yes")
    else:
        print("No")
if s[0] == s[3]:
    if s[1] == s[2]:
        print("Yes")
    else:
        print("No")

Submission status: Wrong Answer

Solution code:
import sys
S = input()
tmp = S[0]
cnt = 0

for i in S:
    if tmp == i:
        cnt += 1

if cnt == 2:
    print("Yes")
    sys.exit()
print("No")

Submission status: Wrong Answer

Solution code:
import numpy as np

S = input()

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

Submission status: Wrong Answer

Solution code:
S=list(input())

def judge(S):        
    if S[0]==S[1] and S[2]==S[3]:
        return 'Yes'
    elif S[0]==S[2] and S[1]==S[3]:
        return 'Yes'
    elif S[0]==S[3] and S[1]==S[2]:
        return 'Yes'
    else:
        return 'No'

print(judge(S))

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python
S = [s for s in 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:
import collections
s = list(input())
c = collections.Counter(s)

if c.most_common()[-1][1] == 1:
    print("No")
else:
    print("Yes")

Submission status: Wrong Answer

Solution code:
"""
# 標準入力取得
## 文字列
 = sys.stdin.readline().rstrip()
 = list(sys.stdin.readline().rstrip())

## 数値
 = int(sys.stdin.readline())
 = map(int, sys.stdin.readline().split())
 = list(map(int, sys.stdin.readline().split()))
 = [list(map(int,list(sys.stdin.readline().split()))) for i in range(h)]  # 二次元配列入力　二次元マップみたいな入力のとき

# 0埋め, 小数点出力桁指定時のときの出力
a = 100
b = 0.987654321
print("{0:06d}-{1:6f}".format(a,b))
000100-0.987654

# 文字列をリストに格納
char_list = list("abcd") # ["a","b","c","d"]
"""

import math
import sys
import itertools
import queue
from fractions import gcd

def lcm(a, b):
    return a * b // gcd(a, b)

mod = 1000000007

if __name__ == "__main__":
    S = list(sys.stdin.readline().rstrip())
    a = S[0]
    S = S[1::]
    if a in S:
        S.remove(a)
    else:
        print("No")
        exit()
    b = S[0]
    S = S[1::]
    if b in S:
        print("Yes")
    else:
        print("No")

Submission status: Wrong Answer

Solution code:
from sys import stdin
S = stdin.readline().rstrip()
if S.count(S[0]) == 2 and S.count(S[1]) == 2:
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

Solution code:
S = list(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 = list(input())

cnt = {}

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

if len(cnt) == 2 & cnt[s[0]] == 2:
    print('ok')
else:
    print('no')

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import collections as c
s=input()
a=c.Counter(s)
if a.values()==[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]:
    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()

n = S.count(S[0])
if not n == 2:
  print("No")
else:
  S = S.replace(S[0], "")
  if len(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:
from collections import Counter

# list(map(int, input().split()))
s = list(input())
v = s[0]
c = Counter(s)
if len(c) == 2 and c[v] == 2:
    print("YES")
else:
    print("NO")

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

for s in S:
    if S.count(S[0]) != 2:
        print('No')
        exit()

print('Yes')

Submission status: Wrong Answer

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

S = input()

if S[0]==S[1]:
    if S[2] == S[3]:
        ans = 'Yes'
    else:
        ans = 'No'
elif S[0]==S[2]:
    if S[1] == S[3]:
        ans = 'Yes'
    else:
        ans = 'No'
elif S[0]==S[3]:
    if S[1] == S[2]:
        ans = 'Yes'
    else:
        ans = 'No'
else:
    ans = 'No'
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[2]==s[1]):
  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")
elif S[0] == S[2]:
    if S[1] == S[3]:
        print("Yes")
elif S[0] == S[3]:
    if 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:
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy,copy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd


def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

def main():
    P=list(input())
    ct_a=0
    ct_s=0
    for x in P:
        if x=='A' :
            ct_a+=1
        elif x=='S':
            ct_s+=1
    if ct_a==2 and ct_s==2:
        print('Yes')
    else:
        print('No')




if  __name__=='__main__':
    main()

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:
# -*- coding: utf-8 -*-
import sys
import collections

def main():
	#A, B, Q = map(int, input().split(" "))
	S = input()
	
	tmp = S[0]
	tmp2 = S[1]
	tmp3 = S[2]
	tmp4 = S[3]
	
	if tmp == tmp2 and tmp3 == tmp4:
		print("Yes")
	elif tmp2 == tmp3 and tmp == tmp4:
		print("Yes")
	else:
		print("No")
	
		
	
	
if __name__ == "__main__":
	main()

Submission status: Wrong Answer

Solution code:
n = list(input())
flag = 1
dict = {}
for i in n:
    if i in dict:
        dict[i] += 1
    else:
        dict[i] = 1

for key,val in dict.items():
    if val == 2:
        print("Yes")
        flag = 0
        break

if flag:
    print("Bad")

Submission status: Wrong Answer

Solution code:
S = input()

if S[0] == S[1] or S[0] == S[2] or S[0] == S[3] or S[1] == S[2] or S[1] == S[3] or 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]:
    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:
words = lambda t : list(map(t, input().split()))
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()
a = list(sorted(a))
print ("Yes" if a[0] == a[1] and a[2] == a[3] else "No")

Submission status: Wrong Answer

Solution code:
# @author 

import sys

class AFiftyFifty:
    def solve(self):
        s = list(input())
        s.sort()
        print("Yes" if (s[0] == s[1] and s[2] == s[3] and s[0] != s[2]) else "No")


solver = AFiftyFifty()
input = sys.stdin.readline

solver.solve()

Submission status: Wrong Answer

Solution code:
s = list(input())
s_ = len(s)

a_ = len(set(s))

if s_ > s_:
  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')