title: Number Subsequences Form Ai Bj Ck
signature: number_subsequences_form_ai_bj_ck <- function(s) {
test_code: 
  
  
  # SOLUTION CODE
  # ============================================
  PLACEHOLDER_CODE_BODY
  
  # TESTING CODE 
  # ============================================
  validate_solution <- function(actual, expected) {
      toString(actual)==toString(expected)
  }
  
  driver <- function(s, expected){
      if (validate_solution(PLACEHOLDER_FN_NAME(s), expected)){
          "PASSED"
      } else{
          "FAILED"
      }
  }
  
  main <- function() {
      cat(sprintf("TEST-0...%s\n",driver(
          "", 
          0L
      )))
  
      cat(sprintf("TEST-1...%s\n",driver(
          "abbc", 
          3L
      )))
  
      cat(sprintf("TEST-2...%s\n",driver(
          "abcabc", 
          7L
      )))
  
      cat(sprintf("TEST-3...%s\n",driver(
          "agsdbkfdc ", 
          1L
      )))
  
      cat(sprintf("TEST-4...%s\n",driver(
          "ababab", 
          0L
      )))
  
      cat(sprintf("TEST-5...%s\n",driver(
          "aaaaaaa", 
          0L
      )))
  
      cat(sprintf("TEST-6...%s\n",driver(
          "aabaaabcc", 
          111L
      )))
  
      cat(sprintf("TEST-7...%s\n",driver(
          "19", 
          0L
      )))
  
      cat(sprintf("TEST-8...%s\n",driver(
          "1001100", 
          0L
      )))
  
      cat(sprintf("TEST-9...%s\n",driver(
          "DtAnuQbU", 
          0L
      )))
  
  }
  
  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;
  }