#T786. 反对称串
反对称串
Description
There is a string composed only of 0s and 1s. For a given substring, if swapping 0s and 1s and then reversing it results in the same original substring, then the substring is considered "anti-symmetric." Given a string of length N, how many substrings are "anti-symmetric"?
Input Format
The first line contains a positive integer N (0 ≤ N ≤ 10000).
The second line contains a 01 string of length N.
Output Format
Output the number of "anti-symmetric" substrings.
8
11001011
7
译文
CodesOnline