Function to count the number of substrings that contains more 1 s than 0 s
def getSubsCount ( input ) : NEW_LINE INDENT n = len ( input ) NEW_LINE nums = [ 0 for i in range ( n ) ] NEW_LINE for i in range ( n ) : NEW_LINE INDENT nums [ i ] = ord ( input [ i ] ) - 48 NEW_LINE if ( nums [ i ] == 0 ) : NEW_LINE INDENT nums [ i ] = - 1 NEW_LINE DEDENT DEDENT DEDENT