QOJ.ac

QOJ

Time Limit: 0.5 s Memory Limit: 64 MB Total points: 100

#13316. Take-out

統計

Little Edna has received the take-out game as a present. Take-out is a single player game, in which the player is given a sequence of n adjacent blocks, numbered from $1$ to $n$. Each block is either black or white, and there are $k$ times as many white blocks as there are black ones.

The player's goal is to remove all the blocks by certain permissible moves.

A single move consists in removing exactly $k$ white blocks and a single black block without changing the positions of other blocks. The move is permissible if there is no "gap" (a space left by a previously taken out block) between any two blocks being removed.

Help poor little Edna in finding any sequence of permissible moves that remove all the blocks.

Input Format

In the first line of the standard input there are two integers, $n$ and $k$ ($2 ≤ n ≤ 1\,000\,000$, $1 ≤ k ≤ n-1$), separated by a single space, that denote the total number of blocks used in the game, and the number of white blocks per black node (to be removed in every move). In all the tests the condition $k+1 \mid n$ holds.

In the second line there is a string of $n$ letters b or c. These tell the colours of successive blocks (in Polish): b (for biały) - white, c (for czarny) - black. You may assume that in all the tests there exists a sequence of permissible moves that takes out all the blocks.

Output Format

Your program should print lines to the standard output. Successive lines should describe successive moves. Each line should contain k+1 integers, in increasing order, separated by single spaces, that denote the numbers of blocks to be removed in the move.

Example

Input

12 2
ccbcbbbbbbcb

Output

10 11 12 
1 8 9 
2 6 7 
3 4 5

Notes

Let $\sqcup$ denote the empty space after a block that was taken out (the gap). By executing the sequence of moves given above, we obtain the following configurations of blocks, in this order: Wykonując podane powyżej ruchy, uzyskujemy kolejno następujące układy klocków:

$$ \begin{array}{cccccccccccc} 1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 & 11 & 12 \\ \hline \texttt{c} & \texttt{c} & \texttt{b} & \texttt{c} & \texttt{b} & \texttt{b} & \texttt{b} & \texttt{b} & \texttt{b} & \texttt{b} & \texttt{c} & \texttt{b} \\ \sqcup & \texttt{c} & \texttt{b} & \texttt{c} & \texttt{b} & \texttt{b} & \texttt{b} & \sqcup & \texttt{b} & \texttt{b} & \texttt{c} & \sqcup \\ \sqcup & \sqcup & \texttt{b} & \texttt{c} & \texttt{b} & \sqcup & \sqcup & \sqcup & \texttt{b} & \texttt{b} & \texttt{c} & \sqcup \\ \sqcup & \sqcup & \sqcup & \sqcup & \sqcup & \sqcup & \sqcup & \sqcup & \texttt{b} & \texttt{b} & \texttt{c} & \sqcup \\ \sqcup & \sqcup & \sqcup & \sqcup & \sqcup & \sqcup & \sqcup & \sqcup & \sqcup & \sqcup & \sqcup & \sqcup \end{array} $$

About Issues

We understand that our problem archive is not perfect. If you find any issues with the problem, including the statement, scoring configuration, time/memory limits, test cases, etc.

You may use this form to submit an issue regarding the problem. A problem moderator will review your issue and proceed it properly.

STOP! Before you submit an issue, please READ the following guidelines:

  1. This is not a place to publish a discussion, editorial, or requests to debug your code. Your issue will only be visible by you and problem moderators. Other users will not be able to view or reply your issues.
  2. Do not submit duplicated issues. If you have already submitted one, please wait for an moderator to review it. Submitting multiple issues will not speed up the review process and might cause your account to be banned.
  3. Issues must be filed in English or Chinese only.
  4. Be sure your issue is related to this problem. If you need to submit an issue regarding another problem, contest, category, etc., you should submit it to the corresponding page.

Active Issues 0

No issues in this category.

Closed/Resolved Issues 0

No issues in this category.