Increase totCount at exterior position
totCount [ index + k * n ] += 1 NEW_LINE now = 0 NEW_LINE totCount [ k * n ] -= 1 NEW_LINE for j in range ( 1 , n + 1 ) : NEW_LINE if ( s [ j - 1 ] == '1' ) : NEW_LINE INDENT now += 1 NEW_LINE DEDENT index = j - k * now NEW_LINE