B - Daily Cookie 2 Editorial /

Time Limit: 2 sec / Memory Limit: 1024 MiB

配点 : 200

問題文

A 問題と似た設定の問題です。A 問題とは、高橋君が食べるクッキーの選び方および求めるものが異なります。

N 個の箱が横一列に並んでおり、そのうちのいくつかの箱にはクッキーが入っています。

各箱の状態は長さ N の文字列 S によって表されます。 具体的には、左から i\ (1\leq i\leq N) 番目の箱は、Si 文字目が @ のときクッキーが 1 枚入っており、. のとき空き箱です。

高橋君は今からの D 日間、一日一回ずつ、その時点でクッキーが入っている箱のうち最も右にある箱のクッキーを選んで食べます。

N 個の箱それぞれについて、D 日間が経過した後にその箱にクッキーが入っているかを求めてください。

なお、S には @D 個以上含まれることが保証されます。

制約

  • 1\leq D \leq N \leq 100
  • N,D は整数
  • S@. からなる長さ N の文字列
  • S には @D 個以上含まれる

入力

入力は以下の形式で標準入力から与えられる。

N D
S

出力

長さ N の文字列を出力せよ。 出力する文字列の i\ (1\leq i\leq N) 文字目は、D 日間が経過した後に左から i 番目の箱にクッキーが入っているならば @、入っていないならば . とせよ。


入力例 1

5 2
.@@.@

出力例 1

.@...

高橋君は以下のように行動します。

  • 1 日目:左から 2,3,5 番目の箱にクッキーが入っている。このうちで最も右にある、左から 5 番目の箱に入っているクッキーを選んで食べる。
  • 2 日目:左から 2,3 番目の箱にクッキーが入っている。このうちで最も右にある、左から 3 番目の箱に入っているクッキーを選んで食べる。
  • 2 日間が経過した後、左から 2 番目の箱にのみクッキーが入っている。

よって、正しい出力は .@... です。


入力例 2

3 3
@@@

出力例 2

...

入力例 3

10 4
@@@.@@.@@.

出力例 3

@@@.......

Score: 200 points

Problem Statement

This problem shares a similar setting with Problem A. The way Takahashi chooses cookies and what you are required to find are different from Problem A.

There are N boxes arranged in a row, and some of these boxes contain cookies.

The state of these boxes is represented by a string S of length N. Specifically, the i-th box (1\leq i \leq N) from the left contains one cookie if the i-th character of S is @, and is empty if it is ..

Over the next D days, Takahashi will choose and eat one cookie per day from among the cookies in these boxes. On each day, he chooses the cookie in the rightmost box that contains a cookie at that point.

Determine, for each of the N boxes, whether it will contain a cookie after D days have passed.

It is guaranteed that S contains at least D occurrences of @.

Constraints

  • 1 \leq D \leq N \leq 100
  • N and D are integers.
  • S is a string of length N consisting of @ and ..
  • S contains at least D occurrences of @.

Input

The input is given from Standard Input in the following format:

N D
S

Output

Print a string of length N. The i-th character (1 \leq i \leq N) of the string should be @ if the i-th box from the left contains a cookie after D days have passed, and . otherwise.


Sample Input 1

5 2
.@@.@

Sample Output 1

.@...

Takahashi acts as follows:

  • Day 1: There are cookies in the 2nd, 3rd, and 5th boxes from the left. Among these, the rightmost is the 5th box. He eats the cookie in this box.
  • Day 2: There are cookies in the 2nd and 3rd boxes. Among these, the rightmost is the 3rd box. He eats the cookie in this box.
  • After two days have passed, only the 2nd box from the left contains a cookie.

Therefore, the correct output is .@....


Sample Input 2

3 3
@@@

Sample Output 2

...

Sample Input 3

10 4
@@@.@@.@@.

Sample Output 3

@@@.......