Java code to find number of subsequences of " ab " in the string S which is repeated K times .
import java . io . * ; class GFG { static int countOccurrences ( String s , int K ) { int n = s . length ( ) ; int C = 0 , c1 = 0 , c2 = 0 ; for ( int i = 0 ; i < n ; i ++ ) { if ( s . charAt ( i ) == ' a ' )