If I understand your question correctly, I understand:
If the input string can be rearranged into a palindrome, print "True", otherwise print "False".
Then you can use these simple rules:
- If the length is even, each unique character at the input must have a factor of 2.
- If the length is odd, each unique character, except for one, must be a multiple of 2 times. Only 1 character is allowed not to appear several times.
So, for 3 given examples:
"mmo", an odd length, m happens twice (a multiple of 2), o happens once (not a multiple of 2), so True .
"like", an odd length, a occurs twice (a multiple of 2), k occurs twice (several of two), y occurs once (not a multiple of 2), so True .
"travel", more than one character does not occur in multiples of 2, therefore False .
Additional examples:
"mmorpg", only m is a multiple of 2, the rest is only once, so False .
"mmom", no characters are found multiple of 2, more than one character is found "not multiple of 2 times", therefore False .
At this point, you should understand that if only 1 character is allowed, but not multiple, then you can ignore the length. An even-length string will have 2 or more characters that are not multiple, or not all.
So, the final rule should be as follows:
If no more than 1 unique character is found not in the plural-2 times at the input, the True output otherwise the output will be False .