Title Description: A string from left-to-right and right-to-left read all the same is a palindrome string, given a string, ask the character in the string can make up the minimum number of palindrome string is how manyproblem-solving ideas: If the number of occurrences of a character is even, it will be able to form a palindrome string, if a character appears odd number of times, can only make a palindrome string, the question of the minimum number of palindrome, that is, to find the number of odd occurrences of the number of characters can be, define a store each character occurrences, Count the number of characters that appear odd number of times, that is, the output
1#include <iostream>2#include <string>3 using namespacestd;4 5 intMain ()6 {7 strings;8Cin>>s;9 intn =s.size ();Ten intCount =0; One inta[ the] = {0}; A for(intI=0; i<n;i++) - { -a[s[i]]++; the } - for(intI=0;i< the; i++) - { - if(a[i]%2!=0) + { -count++; + } A } atcout<<count<<Endl; - return 0; -}
Minimum palindrome string--New Ket net (Autumn recruit prepares for three die)-c++ direction