Count of subsequences without concatenation
B1 = 0 NEW_LINE for i in range ( 0 , N ) : NEW_LINE INDENT if ( S [ i ] == '1' ) : NEW_LINE INDENT B1 += 1 NEW_LINE DEDENT elif ( S [ i ] == '0' ) : NEW_LINE INDENT C = C + ( C1 - B1 ) NEW_LINE DEDENT DEDENT