letters = gets.chomp.chars
bool = 0
uniqletters = letters.uniq
bool += 1 if uniqletters.count != 2
uniqletters.each do |s|
  if letters.count(s) != 2
    bool += 1
  end
end
puts bool == 0 ? "Yes" : "No"