from collections import Counter as co

s=co(eval(input()))

if all([i==2 for i in list(s.values())]) and len(list(s.keys()))==2:

  print("Yes")

else:

  print("No")
from collections import Counter

s = eval(input())

c = Counter(s)

if len(c)==2 and all(vi==2 for vi in list(c.values())):

    print("Yes")

else:

    print("No")
from collections import Counter as co

s = co(eval(input()))
if all([i == 2 for i in list(s.values())]) and len(list(s.keys())) == 2:
    print("Yes")
else:
    print("No")

from collections import Counter

s = eval(input())
c = Counter(s)
if len(c) == 2 and all(vi == 2 for vi in list(c.values())):
    print("Yes")
else:
    print("No")

-from collections import Counter as co +from collections import Counter -s = co(eval(input())) -if all([i == 2 for i in list(s.values())]) and len(list(s.keys())) == 2: +s = eval(input()) +c = Counter(s) +if len(c) == 2 and all(vi == 2 for vi in list(c.values())):