a = list(eval(input())) 

s= set(a) 

l = list(s) 

if len(a) == 4 and len(s) == 2 and a.count(l[0]) ==2 and a.count(l[1]) ==2: 

    print('Yes') 

else: 

    print('No') 
let = set(eval(input()))

print(({True: 'Yes', False: 'No'}[len(let) == 2]))

a = list(eval(input()))
s = set(a)
l = list(s)
if len(a) == 4 and len(s) == 2 and a.count(l[0]) == 2 and a.count(l[1]) == 2:
    print("Yes")
else:
    print("No")

let = set(eval(input()))
print(({True: "Yes", False: "No"}[len(let) == 2]))

-a = list(eval(input())) -s = set(a) -l = list(s) -if len(a) == 4 and len(s) == 2 and a.count(l[0]) == 2 and a.count(l[1]) == 2: -    print("Yes") -else: -    print("No") +let = set(eval(input())) +print(({True: "Yes", False: "No"}[len(let) == 2]))