from collections import Counter



S = Counter(eval(input()))

i = 0

count2 = 0

for k, v in list(S.items()):

    i += 1

    if v == 2:

        count2 += 1

        

if i == 2 and count2 == 2:

    print('Yes')

else:

    print('No')
S = eval(input())



if len(set(S)) == 2:

    for x in set(S):

        if S.count(x) == 2:

            continue

        else:

            print('No')

            break

    else:

        print('Yes')

else:

    print('No')
from collections import Counter

S = Counter(eval(input()))
i = 0
count2 = 0
for k, v in list(S.items()):
    i += 1
    if v == 2:
        count2 += 1
if i == 2 and count2 == 2:
    print("Yes")
else:
    print("No")

S = eval(input())
if len(set(S)) == 2:
    for x in set(S):
        if S.count(x) == 2:
            continue
        else:
            print("No")
            break
    else:
        print("Yes")
else:
    print("No")

-from collections import Counter - -S = Counter(eval(input())) -i = 0 -count2 = 0 -for k, v in list(S.items()): -    i += 1 -    if v == 2: -        count2 += 1 -if i == 2 and count2 == 2: -    print("Yes") +S = eval(input()) +if len(set(S)) == 2: +    for x in set(S): +        if S.count(x) == 2: +            continue +        else: +            print("No") +            break +    else: +        print("Yes")