103801: [Atcoder]ABC380 B - Hurdle Parsing
Memory Limit:256 MB
Time Limit:2 S
Judge Style:Text Compare
Creator:
Submit:15
Solved:0
Description
Score : $200$ points
Problem Statement
Iroha has a sequence of positive integers $A = (A_1, A_2, \dots, A_N)$ of length $N$ ($N \ge 1$).
She generated a string $S$ using $A$ as follows:
- Start with $S = $
|
. - For $i = 1, 2, \dots, N$, perform the following operations in order:
- Append $A_i$ copies of
-
to the end of $S$. - Then, append one
|
to the end of $S$.
- Append $A_i$ copies of
Given the generated string $S$, reconstruct the sequence $A$.
Constraints
- $S$ is a string of length between $3$ and $100$, inclusive, generated by the method in the problem statement.
- $A$ is a sequence of positive integers of length at least $1$.
Input
The input is given from Standard Input in the following format:
$S$
Output
Print the answer in the following format, with elements separated by spaces in a single line:
$A_1$ $A_2$ $\dots$ $A_N$
Sample Input 1
|---|-|----|-|-----|
Sample Output 1
3 1 4 1 5
$S = $ |---|-|----|-|-----|
is generated by $A = (3, 1, 4, 1, 5)$.
Sample Input 2
|----------|
Sample Output 2
10
Sample Input 3
|-|-|-|------|
Sample Output 3
1 1 1 6
Output
得分:200分
问题陈述
IROHA有一个长度为N的正整数序列$A = (A_1, A_2, \dots, A_N)$($N \ge 1$)。
她使用$A$生成了一个字符串$S$,如下所示:
- 以$S = $
|
开始。 - 对于$i = 1, 2, \dots, N$,按顺序执行以下操作:
- 在$S$的末尾追加$A_i$个
-
。 - 然后,在$S$的末尾追加一个
|
。
- 在$S$的末尾追加$A_i$个
给定生成的字符串$S$,重构序列$A$。
约束条件
- $S$是由问题陈述中的方法生成的长度在3到100之间(含)的字符串。
- $A$是长度至少为1的正整数序列。
输入
输入从标准输入以下格式给出:
$S$
输出
以以下格式打印答案,元素在同一行中用空格分隔:
$A_1$ $A_2$ $\dots$ $A_N$
示例输入1
|---|-|----|-|-----|
示例输出1
3 1 4 1 5
$S = $ |---|-|----|-|-----|
是由$A = (3, 1, 4, 1, 5)$生成的。
示例输入2
|----------|
示例输出2
10
示例输入3
|-|-|-|------|
示例输出3
1 1 1 6