PHP code to find number of subsequences of " ab " in the string S which is repeated K times .
< ? php function countOccurrences ( $ s , $ K ) { $ n = strlen ( $ s ) ; $ C = 0 ; $ c1 = 0 ; $ c2 = 0 ; for ( $ i = 0 ; $ i < $ n ; $ i ++ ) { if ( $ s [ $ i ] == ' a ' )