Even Strings
You're given a string consisting of the first 20 lowercase letters of the English alphabet (from 'a' through 't'). How many substrings contain an even count of every character present in that range?
Input
- The first line contains an integer n.
- The second line contains a string s of length n.
- Each character of s is a lowercase letter from 'a' to 't' inclusive.
Output
- Single integer: the number of substrings of s in which every letter 'a'..'t' appears an even number of times (zero counts are considered even).
Notes
- A substring is a contiguous block of characters in s.
- Zero occurrences for a letter are considered even.
- We do not count any empty substrings.
Example 1 Input
5
aabbb
Example 1 Output
4