from collections import Counter



S = list(eval(input()))

counter = dict(Counter(S))

cnt_v = list(counter.values())



if len(cnt_v) == 2 and cnt_v[0] == 2:

    print('Yes')

else:

    print('No')



S = sorted(list(eval(input())))

bl = (S[0]==S[1] and S[1]!=S[2] and S[2]==S[3])



print(('Yes' if bl == 1 else 'No'))

from collections import Counter

S = list(eval(input()))
counter = dict(Counter(S))
cnt_v = list(counter.values())
if len(cnt_v) == 2 and cnt_v[0] == 2:
    print("Yes")
else:
    print("No")

S = sorted(list(eval(input())))
bl = S[0] == S[1] and S[1] != S[2] and S[2] == S[3]
print(("Yes" if bl == 1 else "No"))

-from collections import Counter - -S = list(eval(input())) -counter = dict(Counter(S)) -cnt_v = list(counter.values()) -if len(cnt_v) == 2 and cnt_v[0] == 2: -    print("Yes") -else: -    print("No") +S = sorted(list(eval(input()))) +bl = S[0] == S[1] and S[1] != S[2] and S[2] == S[3] +print(("Yes" if bl == 1 else "No"))