title: Number Subsequences Form Ai Bj Ck
signature: function number_subsequences_form_ai_bj_ck(s)
test_code: using Printf
  
  # SOLUTION CODE
  # ============================================
  PLACEHOLDER_CODE_BODY
  
  # TESTING CODE 
  # ============================================
  function validate_solution(actual, expected)
      return actual == expected
  end
  
  function driver(s, expected)
      try
  
          if validate_solution(PLACEHOLDER_FN_NAME(s), expected)
              return "PASSED";
          end
          return "FAILED";
      catch exception_obj
          return string(Base.typename(typeof(exception_obj)).wrapper);
      end
  end
  
  function main()
      
      result = driver("", 0);
      @printf("TEST-0...%s\n",result);
      
      result = driver("abbc", 3);
      @printf("TEST-1...%s\n",result);
      
      result = driver("abcabc", 7);
      @printf("TEST-2...%s\n",result);
      
      result = driver("agsdbkfdc ", 1);
      @printf("TEST-3...%s\n",result);
      
      result = driver("ababab", 0);
      @printf("TEST-4...%s\n",result);
      
      result = driver("aaaaaaa", 0);
      @printf("TEST-5...%s\n",result);
      
      result = driver("aabaaabcc", 111);
      @printf("TEST-6...%s\n",result);
      
      result = driver("19", 0);
      @printf("TEST-7...%s\n",result);
      
      result = driver("1001100", 0);
      @printf("TEST-8...%s\n",result);
      
      result = driver("DtAnuQbU", 0);
      @printf("TEST-9...%s\n",result);
      
  end
  
  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;
  }