title: Number Subsequences Form Ai Bj Ck
signature: class Solution {
  
      public Integer numberSubsequencesFormAiBjCk(String s) {
test_code: import static java.util.Map.entry;  
  import java.util.*;
  import java.lang.*;
  // TESTING CODE 
  // ============================================
  class QuestionEvaluator {
      public static String validateSolution(String s, Integer expected){
          try{
              Driver driver = new Driver();
              if (driver.run(s,expected)){
                  return "PASSED";
              }
              return "FAILED";
              
          } catch (Exception exception_obj){
              return exception_obj.getClass().getSimpleName();
          }
  
      }
      public static void main(String[] args) {
          String result;
          result = validateSolution("", 0);
          System.out.println(String.format("%s%s","TEST-0...",result));    
      
          result = validateSolution("abbc", 3);
          System.out.println(String.format("%s%s","TEST-1...",result));    
      
          result = validateSolution("abcabc", 7);
          System.out.println(String.format("%s%s","TEST-2...",result));    
      
          result = validateSolution("agsdbkfdc ", 1);
          System.out.println(String.format("%s%s","TEST-3...",result));    
      
          result = validateSolution("ababab", 0);
          System.out.println(String.format("%s%s","TEST-4...",result));    
      
          result = validateSolution("aaaaaaa", 0);
          System.out.println(String.format("%s%s","TEST-5...",result));    
      
          result = validateSolution("aabaaabcc", 111);
          System.out.println(String.format("%s%s","TEST-6...",result));    
      
          result = validateSolution("19", 0);
          System.out.println(String.format("%s%s","TEST-7...",result));    
      
          result = validateSolution("1001100", 0);
          System.out.println(String.format("%s%s","TEST-8...",result));    
      
          result = validateSolution("DtAnuQbU", 0);
          System.out.println(String.format("%s%s","TEST-9...",result));    
      
      }
  }
  
  class Driver{
      public boolean run(String s, Integer expected){
  
          PLACEHOLDER_CLS_NAME sol = new PLACEHOLDER_CLS_NAME();
          return validateSolution(sol.PLACEHOLDER_FN_NAME(s),expected);
      }
      
      public boolean validateSolution(Integer actual, Integer expected){
          return actual.equals(expected);
      }
  }
  
  
  // SOLUTION CODE
  // ============================================
  PLACEHOLDER_CODE_BODY
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;
  }