str = gets
condition = true

str.chars do |char|
  a_str = str.delete(char)
  condition &&= (a_str[0] == a_str[1]) && (a_str.size == 2) && (a_str =~ /^[A-Z]+$/)
  break unless condition
end

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

print result
