Ratio Substrings - MarisaOJ: Marisa Online Judge

Ratio Substrings

Time limit: 1000 ms
Memory limit: 256 MB
Given a binary string of length n, count the number of consecutive substrings with a ratio of 0's to 1's equal to xy. ### Input - The first line consists of two integers x and y. - The second line consists of a binary string of length n. ### Output - Print the number of consecutive substrings that satisfy the condition. ### Constraints - 1≤x,y≤n≤105. ### Example Input: 121010 Output: 1