P24970 [AtCoder] [ARC040B] Painting the Floor in a Straight Line
普及
题目描述

Problem Description

Takahashi, the squid, loves painting the floor. The floor consists of $ N $ squares arranged in a single row from left to right. The $ i $ -th square from the left is referred to as square $ i $. Some squares are already painted, while others are not. Takahashi is trying to paint all the squares using a gun that has a shooting range of $ R $. Takahashi starts at square $ 1 $. Within $ 1 $ second, he can perform one of the following actions:

  • Move to the right by one square. That is, move from square $ i $ to square $ i+1 $. This action cannot be performed when he is at square $ N $.
  • Shoot the gun to paint the floor. When shooting from square $ i $, all squares from square $ i $ to square $ i+R-1 $ are painted. If $ i+R-1 $ is greater than $ N $, then all squares from square $ i $ to square $ N $ are painted.

Find the minimum time required for Takahashi to paint all the squares.

Input Format

The input is given from the standard input in the following format:

$ N $ $ R $ $ S $

  • The first line contains two integers $N\ (1\ ≦\ N\ ≦\ 100)$ representing the number of squares and $R\ (1\ ≦\ R\ ≦\ N)$ representing the shooting range of the gun, separated by spaces.
  • The second line contains a string $ S $ of length $ N $. The $i\ (1\ ≦\ i\ ≦\ N)$ -th character of this string represents the status of square $ i $ as follows:
  • . indicates that the square is not yet painted.
  • o indicates that the square is already painted.

Output Format

Output the minimum time required for Takahashi to paint all the squares in one line. End the output with a newline.

Sample Input and Output

Sample Input #1

7 3
...o.o.

Sample Output #1

6

Sample Input #2

8 4
...o.ooo

Sample Output #2

3

Sample Input #3

4 4
oooo

Sample Output #3

0

Notes/Hints

Sample Explanation 1

Shooting the gun → Moving forward by 4 steps → Shooting the gun, this sequence of actions results in the minimum time.

Sample Explanation 2

Shooting the gun → Moving forward by 1 step → Shooting the gun, this sequence of actions results in the minimum time.

Sample Explanation 3

All squares are already painted from the beginning.

输入格式

见题面 Input 部分

输出格式

见题面 Output 部分

样例输入
7 3 ...o.o.
样例输出
6