from collections import Counter

S=list(eval(input()))

print(('Yes' if len(set(S))==2 and Counter(S)[S[0]]==2 else 'No'))
S=list(eval(input()))

n=len(set(S))

print(("Yes" if n==2 and S.count(S[0])==2 else "No"))
from collections import Counter

S = list(eval(input()))
print(("Yes" if len(set(S)) == 2 and Counter(S)[S[0]] == 2 else "No"))

S = list(eval(input()))
n = len(set(S))
print(("Yes" if n == 2 and S.count(S[0]) == 2 else "No"))

-from collections import Counter - -print(("Yes" if len(set(S)) == 2 and Counter(S)[S[0]] == 2 else "No")) +n = len(set(S)) +print(("Yes" if n == 2 and S.count(S[0]) == 2 else "No"))