from collections import Counter



s = eval(input())



t = Counter(s)



a = []

for i,j in list(t.items()):

    a.append(j)



if len(a) == 2:

    if a[0] == a[1]:

        print("Yes")

        exit()



print("No")
s = list(eval(input()))



s.sort()



if s[0] == s[1] and s[2] == s[3] and s[0] != s[2]:

    print("Yes")



else:

    print("No")
from collections import Counter

s = eval(input())
t = Counter(s)
a = []
for i, j in list(t.items()):
    a.append(j)
if len(a) == 2:
    if a[0] == a[1]:
        print("Yes")
        exit()
print("No")

s = list(eval(input()))
s.sort()
if s[0] == s[1] and s[2] == s[3] and s[0] != s[2]:
    print("Yes")
else:
    print("No")

-from collections import Counter - -s = eval(input()) -t = Counter(s) -a = [] -for i, j in list(t.items()): -    a.append(j) -if len(a) == 2: -    if a[0] == a[1]: -        print("Yes") -        exit() -print("No") +s = list(eval(input())) +s.sort() +if s[0] == s[1] and s[2] == s[3] and s[0] != s[2]: +    print("Yes") +else: +    print("No")