title: Find Number Times String Occurs Given String 1
signature: function find_number_times_string_occurs_given_string_1(a, b)
test_code: using Printf
  
  # SOLUTION CODE
  # ============================================
  PLACEHOLDER_CODE_BODY
  
  # TESTING CODE 
  # ============================================
  function validate_solution(actual, expected)
      return actual == expected
  end
  
  function driver(a, b, expected)
      try
  
          if validate_solution(PLACEHOLDER_FN_NAME(a, b), expected)
              return "PASSED";
          end
          return "FAILED";
      catch exception_obj
          return string(Base.typename(typeof(exception_obj)).wrapper);
      end
  end
  
  function main()
      
      result = driver("fZOKCdZ Lav", "fKA", 0);
      @printf("TEST-0...%s\n",result);
      
      result = driver("2", "187012", 0);
      @printf("TEST-1...%s\n",result);
      
      result = driver("1000001110", "0", 6);
      @printf("TEST-2...%s\n",result);
      
      result = driver("IAOyBzgIWHo", "oA", 0);
      @printf("TEST-3...%s\n",result);
      
      result = driver("211806", "10", 2);
      @printf("TEST-4...%s\n",result);
      
      result = driver("1", "001011100", 0);
      @printf("TEST-5...%s\n",result);
      
      result = driver("CVaQTG", "CT", 1);
      @printf("TEST-6...%s\n",result);
      
      result = driver("6265187228", "628", 6);
      @printf("TEST-7...%s\n",result);
      
      result = driver("10111101101000", "01111", 35);
      @printf("TEST-8...%s\n",result);
      
      result = driver("vEi", "bigsvkQG", 0);
      @printf("TEST-9...%s\n",result);
      
  end
  
  main()
source_py: def find_number_times_string_occurs_given_string_1(a, b):
      m = len(a)
      n = len(b)
      lookup = [([0] * (n + 1)) for i in range((m + 1))]
      for i in range((n + 1)):
          lookup[0][i] = 0
      for i in range((m + 1)):
          lookup[i][0] = 1
      for i in range(1, (m + 1)):
          for j in range(1, (n + 1)):
              if (a[(i - 1)] == b[(j - 1)]):
                  lookup[i][j] = (lookup[(i - 1)][(j - 1)] + lookup[(i - 1)][j])
              else:
                  lookup[i][j] = lookup[(i - 1)][j]
      return lookup[m][n]
source_cpp: int find_number_times_string_occurs_given_string_1(string a, string b) {
    int m = a . length ( );
    int n = b . length ( );
    int lookup [ m + 1 ] [ n + 1 ] = {
      {
        0 }
      };
      for ( int i = 0;
      i <= n;
      ++ i ) lookup [ 0 ] [ i ] = 0;
      for ( int i = 0;
      i <= m;
      ++ i ) lookup [ i ] [ 0 ] = 1;
      for ( int i = 1;
      i <= m;
      i ++ ) {
        for ( int j = 1;
        j <= n;
        j ++ ) {
          if ( a [ i - 1 ] == b [ j - 1 ] ) lookup [ i ] [ j ] = lookup [ i - 1 ] [ j - 1 ] + lookup [ i - 1 ] [ j ];
          else lookup [ i ] [ j ] = lookup [ i - 1 ] [ j ];
        }
      }
      return lookup [ m ] [ n ];
    }