Under construction

Still being built. Things may change

Fishing

Time limit1sMemory limit1024 MB

Summary
Find the starting day among the first N days whose window of k consecutive days contains the most rainy days, choosing the smallest index on a tie.
Level

Easy3 of 10

Topics
Sliding window, Array, Prefix sum
Solved
No attempts yet

Problem

Martynas is planning a fishing trip and wants to spend kk days fishing. Since fish bite best on rainy days, he wants to choose kk consecutive days that contain as many rainy days as possible.

Input

The first line contains two integers NN and kk: NN is the number of days on which the trip may start, and kk is how many consecutive days the trip lasts.

The second line gives the weather forecast for N+k−1N + k - 1 days as a string of characters cic_i (1≤i≤N+k−11 \le i \le N + k - 1):

  • L — day ii is rainy;
  • S — day ii is sunny.

Output

Output a single number — the day on which the trip begins. Martynas wants to leave as early as possible, so if several starting days give the maximum number of rainy days, output the smallest one. (The answer is between 11 and NN.)

Constraints

  • 1≤k,N≤1 000 0001 \le k, N \le 1\,000\,000.

Examples1

  1. Example 1

    Input
    10 4
    SSSLSLSLSSSSS
    
    Expected output
    3