"Life is hard. It's better to avoid all difficulties, just press the skip button!"
Mux was in the park and found strings of s and s on a bench. He needs to determine how many good subarrays each string contains. A subarray is considered good if the difference between the number of s and s in the subarray is even. Note that this difference does not necessarily have to be positive.
Task
Given strings, determine for each string how many subarrays have an even difference between the number of s and s.
Input data
The first line of the input contains the number . For each , the next two lines contain the length of the -th string found by Mux and the string itself.
Output data
For each , print the answer to Mux's question for the -th string.
Constraints and clarifications
- , where is the length of each string
- The string contains only the characters and .
- The sum of the lengths of all strings does not exceed .
- Note. This problem has no relation to the problem suxumetre.
# | Points | Constraints |
---|---|---|
1 | 0 | Example |
2 | 23 | |
3 | 36 | |
4 | 13 | The string contains only s |
5 | 23 | No additional constraints |
Example
stdin
4
9
010100100
7
0000000
18
100100010111010111
11
00000000000
stdout
20
12
81
30
Explanation
For the first string, some of the subarrays that meet the required property are 0101
, 10
, 1001
, etc.