Time Limit: 2 sec / Memory Limit: 1024 MB
配点 : 200 点
問題文
あるプログラミングコンテストの予選に N 人が参加し、参加者全員が異なる順位を得ました。
長さ N の文字列 S が与えられ、この文字列は決勝への参加希望の有無を表現します。具体的には下記の通りです。
- S の i 文字目が
o
なら、予選 i 位の参加者が決勝への参加を希望した。 - S の i 文字目が
x
なら、予選 i 位の参加者が決勝への参加を希望しなかった。
決勝への参加を希望した参加者のうち順位の小さい方から K 人が予選を通過します。
以下の条件を満たす長さ N の文字列 T を出力してください。
- 予選 i 位の参加者が予選を通過する場合、 T の i 文字目は
o
- 予選 i 位の参加者が予選を通過しない場合、 T の i 文字目は
x
制約
- N,K は整数
- 1 \le K \le N \le 100
- S は
o
とx
からなる長さ N の文字列 - S には少なくとも K 個の
o
が含まれる
入力
入力は以下の形式で標準入力から与えられる。
N K S
出力
答えを出力せよ。
入力例 1
10 3 oxxoxooxox
出力例 1
oxxoxoxxxx
この入力の場合、予選の参加者は N=10 人であり、予選を通過する人数は K=3 人です。
- 予選 1 位の参加者は決勝への参加を希望しているため、予選を通過します。この時点で、通過者は 1 人です。
- 予選 2,3 位の参加者は決勝への参加を希望していないため、予選を通過しません。
- 予選 4 位の参加者は決勝への参加を希望しているため、予選を通過します。この時点で、通過者は 2 人です。
- 予選 5 位の参加者は決勝への参加を希望していないため、予選を通過しません。
- 予選 6 位の参加者は決勝への参加を希望しているため、予選を通過します。この時点で、通過者は 3 人です。
- ここで、予選を通過した人数が 3 人となりました。なので、予選 7 位以下の参加者は予選を通過しません。
Score : 200 points
Problem Statement
There were N contestants in the qualification round of a programming contest. All contestants got distinct ranks.
You are given a length-N string S, which represents whether the contestants want to participate in the final round or not. Specifically,
- if the i-th character of S is
o
, the contestant ranked i-th in the qualification wants to participate in the final; - if the i-th character of S is
x
, the contestant ranked i-th in the qualification does not want to participate in the final.
Among those who want to participate in the final, K contestants with the smallest ranks advance to the final.
Print a string T of length N that satisfies the following conditions:
- if the contestant ranked i-th in the qualification advances to the final, the i-th character of T is
o
; - if the contestant ranked i-th in the qualification does not advance to the final, the i-th character of T is
x
.
Constraints
- N and K are integers.
- 1 \le K \le N \le 100
- S is a string of length N consisting of
o
andx
. - S has at least K
o
's.
Input
The input is given from Standard Input in the following format:
N K S
Output
Print the answer.
Sample Input 1
10 3 oxxoxooxox
Sample Output 1
oxxoxoxxxx
In this input, N=10 people took part in the qualification round, and K=3 of them advance to the final.
- The participant who ranked 1-st in the qualification wants to participate in the final, so the participant advances to the final. 1 participant has advanced so far.
- The participants who ranked 2-nd and 3-rd in the qualification do not want to participate in the final, so the participants do not advance to the final.
- The participant who ranked 4-th in the qualification wants to participate in the final, so the participant advances to the final. 2 participants have advanced so far.
- The participants who ranked 5-th in the qualification does not want to participate in the final, so the participant does not advance to the final.
- The participant who ranked 6-th in the qualification wants to participate in the final, so the participant advances to the final. 3 participants have advanced so far.
- Now that 3 people have advanced to the final, no participants ranked 7-th or lower advance to the final.