string = gets.chomp

# { "A" => ["A", "A"], "S" => ["S", "S"] } => [2, 2]
result = string.split(//)
          .group_by { |e| e }
          .map { |k,v| v.size }
          .all? { |e| e == 2 }

puts result ? 'Yes' : 'No'