Count no . Of K 's after a K
for i in range ( len ( s ) - 1 , - 1 , - 1 ) : NEW_LINE INDENT if s [ i ] == ' K ' : NEW_LINE INDENT countk += 1 NEW_LINE table [ j ] [ 1 ] = countk NEW_LINE j -= 1 NEW_LINE DEDENT DEDENT