s = gets

if s.length == 4
  if s =~ /[A-Z]/ && s.split("").uniq! != nil
      if s.split("").uniq!.length == 2
        puts "Yes"
    else
        puts "No"
    end
  else
    puts "No"
  end
else
  puts "No"
end