Dr. D And Her Wishes

0

0 votes
Problem

Dr. D wants to be in live-in-relationship with his boyfriend. She went to her parents for permission. 

Her parents want to check that she is ready to live with some other guy independently or not. Her Father decided to give n tasks to Dr. D . every minute he gives a task and if Dr. D performs good in that task then output of that task is 1 otherwise it is  0. Her father noted the output of all the n tasks in the form of a string S where ith character of String S represents the output of the task given at ith minute to Dr. D .

 

At the end, Her father Counts the Total number of intervals in which Dr. D performs good exactly k Times. Help her father to count his desired number.

INPUT

First line of input consist of an integer k (<k < 100000).

Second line of input consist of string S of length n  (0 < n < 100000).

S[i] denotes performance of Dr. D in task given at ith Minute.(< S[i] < 1).

 

OUTPUT

Total number of intervals in which Dr. D performs good exactly k Times.

 

Note: Copy Paste feature is turned off. Please don't waste your time to code in your own editor. use hackerearth's code editor only.

Time Limit: 5
Memory Limit: 256
Source Limit:
Explanation

In the First Test Case,

Minutes of Given Task:        1 2 3 4

Performance in the Task:     1 0 1 0

In the 

  • interval (0,1] minutes, she wins exactly k time.
  • interval (0,2] minutes, she wins exactly k time.
  • interval (1,3] minutes, she wins exactly k time.
  • interval (1,4] minutes, she wins exactly k time.
  • interval (2,3] minutes, she wins exactly k time.
  • interval (2,4] minutes, she wins exactly k time.
Editor Image

?