#T583. 反对称串

反对称串

Description

There is a string composed only of 0s and 1s. For a given substring, if swapping all 0s and 1s and then reversing it results in the original substring, then the substring is considered "anti-symmetric." Given a string of length N, how many such "anti-symmetric" substrings are there?

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

(注:根据提供的上下文,"CodesOnline" 是一个专有名词/品牌名称,通常保持原样不翻译。若需进一步说明其含义,可补充为 "CodesOnline(在线代码平台)")

保留建议:

  1. 作为技术品牌名,遵循"名从主人"原则
  2. 首字母大写保持品牌标识性
  3. 无需引号或斜体等特殊标注

需要调整请随时告知。