s = gets.chomp.split("")

if s[0] == s[1] && s[2] == s[3] then
  puts "Yes"
elsif s[0] == s[2] && s[1] == s[3] then
  puts "Yes"
elsif s[0] == s[3] && s[1] == s[2] then
  puts "Yes"
else
  puts "No"
end
