If current character is ' b ' , then there are following possibilities : a ) Current character begins a new subsequence of b 's with aCount subsequences. b) Current character is part of bCount subsequences. c) Current character is not part of  bCount subsequences.
else if ( s [ i ] == ' b ' ) bCount = ( aCount + 2 * bCount ) ;