logo AlgoBeat OnlineJudge
登录 注册

#216218. [ICPC 2016 NAIPC] K-Inversions

内存限制:512 MiB 时间限制:5000 ms 标准输入输出
题目类型:VJudge(洛谷) 评测方式:VJudge
上传者: 匿名

题目描述

You are given a string consisting only of upper case letters A and B. For an integer , a pair of indices and () is called a -inversion if and only if , and .

Consider the string BABA. It has two 1-inversions and one 3-inversion. It has no 2-inversions.

:::align{center} :::

For each between and (inclusive), print the number of -inversions in the string .

输入格式

Each input will consist of a single test case. Note that your program may be run multiple times on different inputs. The input will consist of a single line with a string , which consists of only upper case As and Bs. The string will be between and characters long. There will be no spaces.

输出格式

Output lines, each with a single integer. The first line’s integer should be the number of 1-inversions, the second should be the number of 2-inversions, and so on.

样例

样例输入 1

BABA

样例输出 1

2
0
1

样例输入 2

BBBBBAAAAA

样例输出 2

1
2
3
4
5
4
3
2
1