text of lowercase English letters. For every letter that appears in it, count how many times it appears.
Pick two letters: the first must appear an odd number of times, the second an even number of times. Make the difference "count of the first minus count of the second" as large as possible and return it (it may come out negative).
The string is guaranteed to contain at least one letter with an odd count and at least one with an even count.text='mississippi' → -1
"m" occurs once, "i" and "s" four times each, "p" twice. The odd counts are 1; the even ones are 4, 4 and 2. The best difference is 1 - 2 = -1.
text='zzzzzxxyw' → 3
"z" occurs 5 times (odd) and "x" twice (even): 5 - 2 = 3.
text consists only of lowercase English letterstext='mississippi'
-1
Run checks the first 3 tests in your browser. Submit checks all 30 tests on the server, hidden ones included.