You are given a binary string S. Count the number of non-empty substrings where the number of 0 is equal to the number of 1.
A substring is a consecutive sequence of characters within a string. For example, given the string marisa
, ris
is a substring, but rsa
is not.
Input:
10010
Output:
4