str = gets

a = (str[0] == str[1]) && (str[2] == str[3]) && (str[0] != str[2])
b = (str[0] == str[2]) && (str[1] == str[3]) && (str[0] != str[1])
c = (str[0] == str[3]) && (str[1] == str[2]) && (str[0] != str[1])

condition = a || b || c

condition ? result = "Yes" : result = "No"

print result
