Python3 code to find number of subsequences of " ab " in the string S which is repeated K times .
def countOccurrences ( s , K ) : NEW_LINE INDENT n = len ( s ) NEW_LINE c1 = 0 NEW_LINE c2 = 0 NEW_LINE C = 0 NEW_LINE for i in range ( n ) : NEW_LINE INDENT if s [ i ] == ' a ' : NEW_LINE DEDENT DEDENT