C - Postponement of meetings Editorial /

Time Limit: 2 sec / Memory Limit: 1024 MiB

問題文

整数 N,K と長さ N の文字列 S が与えられます。

あなたは会議の日程を決めています。

ある日に会議ができるかどうかは文字列 S で与えられ、 Si 文字目が o なら i 日目に会議ができることを、 x なら会議ができないことを表しています。

あなたは会議を K 日目に行う予定でしたが、その日の会議は延期になりました。

あなたは K+1 日目以降で会議ができる日のうち K 日目に最も近い日に会議を振り替えようとしています。

振り替えた後の会議がいつになるか求めてください。ただし、会議が N 日目までに必ず振り替えられることが保証されます。

制約

  • 2\le N\le 10^3
  • 1\le K\le N
  • N,K は整数
  • So および x からなる長さ N の文字列
  • SK 文字目は o
  • SK+1 文字目以降に o が必ず存在する

入力

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

N K
S

出力

答えを出力せよ。


入力例 1

6 2
ooxoxo

出力例 1

4

会議が可能なのは 1,2,4,6 日目です。 2+1=3 日目以降で会議可能な日のうち 2 日目に最も近いのは 4 日目なので、 4 を出力してください。


入力例 2

5 4
ooooo

出力例 2

5

入力例 3

11 6
ooxxxoxooxx

出力例 3

8

Problem Statement

You are given integers N and K, and a length-N string S.

You are scheduling a meeting.

Whether you can set a meeting on each day is described by a string S. If the i-th character of S is o, you can set a meeting on day i; if it is x, you cannot.

The meeting was scheduled on day K, but it was postponed.

You now need to reschedule it to the closest available day on or after day (K + 1).

Find the new day for the meeting. It is guaranteed that you can always set the meeting by day N.

Constraints

  • 2\le N\le 10^3
  • 1\le K\le N
  • N and K are integers.
  • S is a string of length N, consisting of o and x.
  • The K-th character of S is o.
  • There is an o at the (K+1)-th or later position of S.

Input

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

N K
S

Output

Print the answer.


Sample Input 1

6 2
ooxoxo

Sample Output 1

4

You can set the meeting on days 1,2,4,6. On or after day 2+1=3, the closest to day 2 is day 4, so print 4.


Sample Input 2

5 4
ooooo

Sample Output 2

5

Sample Input 3

11 6
ooxxxoxooxx

Sample Output 3

8