AT_past202212_d 坊主めくり
Description
$ N $ players will play a game using cards.
Initially, the first pile contains $ M $ cards, the second pile contains $ 0 $ cards, and each player has $ 0 $ cards.
Each card has one of the symbols `+`, `0`, and `-` written on it. The symbol on the $ i $ -th card from the top of the initial first pile is $ S_i $ .
In the game, the players take turns doing the following, in this order: player $ 1 $ , player $ 2 $ , $ \ldots $ , player $ N-1 $ , player $ N $ , player $ 1 $ , player $ 2 $ , $ \dots $
- If the first pile contains $ 0 $ cards, end the game. Otherwise, the current player draws the top card from the first pile, and adds it to the player's hand. Then, according to the symbol written on that card, the player does the following.
- If `+` is written, add all cards in the second pile to the player's hand.
- If `0` is written, do nohing.
- If `-` is written, move all cards in the player's hand to the second pile.
Find the number of cards in each player's hand at the end of the game.
Input Format
Input is given from Standard Input in the following format:
> $ N $ $ M $ $ S_1 S_2 \ldots S_M $
Output Format
Print $ N $ lines.
The $ i $ -th line should contain the number of cards in player $ i $ 's hand.
Explanation/Hint
### Sample Explanation 1
The game proceeds as follows.
- Player $ 1 $ draws a `0` card and adds it to the hand. Now, player $ 1 $ has $ 1 $ card.
- Player $ 2 $ draws a `0` card and adds it to the hand. Now, player $ 2 $ has $ 1 $ card.
- Player $ 3 $ draws a `0` card and adds it to the hand. Now, player $ 3 $ has $ 1 $ card.
- Player $ 1 $ draws a `-` card, adds it to the hand, and then moves all cards in the hand to the second pile. Now, player $ 1 $ has $ 0 $ cards, and the second pile has $ 2 $ cards.
- Player $ 2 $ draws a `-` card, adds it to the hand, and then moves all cards in the hand to the second pile. Now, player $ 2 $ has $ 0 $ cards, and the second pile has $ 4 $ cards.
- Player $ 3 $ draws a `+` card, adds it to the hand, and then adds all cards in the second pile to the hand. Now, player $ 3 $ has $ 6 $ cards, and the second pile has $ 0 $ cards.
- The first pile has no cards, so the game ends.
### Constraints
- $ 2 \leq N \leq 2\times 10^5 $
- $ 1 \leq M \leq 2\times 10^5 $
- $ S_i $ is `+`, `0`, or `-`.