jdef main
  input_chars = gets.chomp.chars.sort
  if input_chars.uniq.length != 2
    print 'No'
    return
  end

  if input_chars[0] == input_chars[2]
    print 'No'
    return
  end

  print 'Yes'
end

main
