Problem: 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.

Submission attempts (in order):
s = input()
if len(s) == 4:

    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")
    elif s[2] == s[3]:
        if s[0] == s[1]:
            print("yes")
        else:
            print("no")
    else:
        print("no")

else:
    print("no")



s = sorted(list(input()))

if len(s) == 4:
    if s[0] == s[1] and s[2] == s[3] and s[0] != s[3]:
        print("yes")
    else:
        print("no")
else:
    print("no")


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

else:
    print("no")

s = list(input())
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")
elif s[2] == s[3]:
    if s[0] == s[1]:
        print("yes")
    else:
        print("no")
else:
    print("no")

s = list(input())
if len(s) == 4:
    if s[0] == s[1]:
        if s[2] == s[3] and s[0] != s[2]:
            print("yes")
        else:
            print("no")
    elif s[1] == s[2] and s[1] != s[0]:
        if s[0] == s[3]:
            print("yes")
        else:
            print("no")
    elif s[2] == s[3] and s[2] != s[0]:
        if s[0] == s[1]:
            print("yes")
        else:
            print("no")
    else:
        print("no")
else:
    print("no")

s = sorted(list(input()))
if len(s) == 4 
    if s[0] == s[1]:
        if s[2] == s[3] and s[1] != s[2]:
            print("yes")
        else:
            print("no")

    else:
        print("no")
else:
    print("no")

s = list(input())
if len(s) == 4:
    if s[0] == s[1]:
        if s[2] == s[3] and s[0] != s[2]:
            print("yes")
        else:
            print("no")
    elif s[1] == s[2] :
        if s[0] == s[3] and s[1] != s[0]:
            print("yes")
        else:
            print("no")
    elif s[2] == s[3] :
        if s[0] == s[1] and s[2] != s[0]:
            print("yes")
        else:
            print("no")
    else:
        print("no")
else:
    print("no")



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


s = input()
if len(s) == 4:
    if s[0] == s[1]:
        if s[2] == s[3] and s[0] != s[2]:
            print("yes")
        else:
            print("no")
    elif s[1] == s[2] and s[1] != s[0]:
        if s[0] == s[3]:
            print("yes")
        else:
            print("no")
    elif s[2] == s[3] and s[2] != s[0]:
        if s[0] == s[1]:
            print("yes")
        else:
            print("no")
    else:
        print("no")
else:
    print("no")


s = sorted(input())

if s[0] == s[1] and s[2] == s[3] and s[0] != s[3]:
    print("yes")
else:
    print("no")


s = sorted(list(input()))
if len(s) == 4:
    if s[0] == s[1]:
        if s[2] == s[3] and s[1] != s[2]:
            print("yes")
        else:
            print("no")

    else:
        print("no")
else:
    print("no")


s = sorted(input())

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

Verdicts: Wrong Answer

Wrong Answer

Wrong Answer

Wrong Answer

Wrong Answer

Runtime Error

Wrong Answer

Runtime Error

Wrong Answer

Wrong Answer

Wrong Answer

Accepted