import collections



s=eval(input())

print(('Yes'if len(set(s))==2 and collections.Counter(s).most_common()[0][1]==2 else 'No'))
s=eval(input())

print(('Yes'if len(set(s))==2 and s.count(s[0])==2 else 'No'))
import collections

s = eval(input())
print(
    (
        "Yes"
        if len(set(s)) == 2 and collections.Counter(s).most_common()[0][1] == 2
        else "No"
    )
)

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

-import collections - -print( -    ( -        "Yes" -        if len(set(s)) == 2 and collections.Counter(s).most_common()[0][1] == 2 -        else "No" -    ) -) +print(("Yes" if len(set(s)) == 2 and s.count(s[0]) == 2 else "No"))