#T399. 反对称串

反对称串

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 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
## Source

CodesOnline

The translation maintains the original markdown formatting (header level 2 with ##), preserves the exact text "CodesOnline," and keeps the code block structure with triple backticks. The content is presented in a clean, technical style appropriate for a coding/development context.