title: Number Subsequences Form Ai Bj Ck
signature: function numberSubsequencesFormAiBjCk($s) {
test_code: <?php
  
  
  // SOLUTION CODE 
  // ============================================
  PLACEHOLDER_CODE_BODY
  
  // TESTING CODE 
  // ============================================
  function validateSolution($actual, $expected){
      return serialize($actual) == serialize($expected);
  }
  
  function driver($s, $expected){
      try{
        if (validateSolution(PLACEHOLDER_FN_NAME($s), $expected)){
          return "PASSED";
        }
        return "FAILED";
      }
      catch (Exception $exception_obj) {
        return get_class($exception_obj);
      }
  }
  
  function main(){
      printf("TEST-0...%s\n",driver(
        "", 
        0));
      
      printf("TEST-1...%s\n",driver(
        "abbc", 
        3));
      
      printf("TEST-2...%s\n",driver(
        "abcabc", 
        7));
      
      printf("TEST-3...%s\n",driver(
        "agsdbkfdc ", 
        1));
      
      printf("TEST-4...%s\n",driver(
        "ababab", 
        0));
      
      printf("TEST-5...%s\n",driver(
        "aaaaaaa", 
        0));
      
      printf("TEST-6...%s\n",driver(
        "aabaaabcc", 
        111));
      
      printf("TEST-7...%s\n",driver(
        "19", 
        0));
      
      printf("TEST-8...%s\n",driver(
        "1001100", 
        0));
      
      printf("TEST-9...%s\n",driver(
        "DtAnuQbU", 
        0));
      
  }
  
  main();
  ?>
source_py: def number_subsequences_form_ai_bj_ck(s):
      aCount = 0
      bCount = 0
      cCount = 0
      for i in range(len(s)):
          if (s[i] == 'a'):
              aCount = (1 + (2 * aCount))
          elif (s[i] == 'b'):
              bCount = (aCount + (2 * bCount))
          elif (s[i] == 'c'):
              cCount = (bCount + (2 * cCount))
      return cCount
source_cpp: int number_subsequences_form_ai_bj_ck(string s) {
    int aCount = 0;
    int bCount = 0;
    int cCount = 0;
    for ( unsigned int i = 0;
    i < s . size ( );
    i ++ ) {
      if ( s [ i ] == 'a' ) aCount = ( 1 + 2 * aCount );
      else if ( s [ i ] == 'b' ) bCount = ( aCount + 2 * bCount );
      else if ( s [ i ] == 'c' ) cCount = ( bCount + 2 * cCount );
    }
    return cCount;
  }