from collections import Counter

S = eval(input())

input_counter = Counter(S)



if len(input_counter) == 2:

    for v in list(input_counter.values()):

        if v != 2:

            print('No')

            exit()

    else:

        print('Yes')

else:

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

for s in S:

  if S.count(s) != 2:

    print('No')

    exit()

print('Yes')
from collections import Counter

S = eval(input())
input_counter = Counter(S)
if len(input_counter) == 2:
    for v in list(input_counter.values()):
        if v != 2:
            print("No")
            exit()
    else:
        print("Yes")
else:
    print("No")

S = eval(input())
for s in S:
    if S.count(s) != 2:
        print("No")
        exit()
print("Yes")

-from collections import Counter - -input_counter = Counter(S) -if len(input_counter) == 2: -    for v in list(input_counter.values()): -        if v != 2: -            print("No") -            exit() -    else: -        print("Yes") -else: -    print("No") +for s in S: +    if S.count(s) != 2: +        print("No") +        exit() +print("Yes")