title: Find Number Times String Occurs Given String 1
signature: func findNumberTimesStringOccursGivenString1(a string, b string) int {
test_code: package main
  
  import (
      "fmt"
      "reflect"
      "math"
      "sort"
  )
  
  // SOLUTION CODE
  // ===================================
  PLACEHOLDER_CODE_BODY
  
  // TESTING CODE
  // ===================================
  func validateSolution(actual int, expected int) bool {
      return reflect.DeepEqual(actual,expected)
  }
  
  func driver(a string, b string, expected int) string {
      if validateSolution(PLACEHOLDER_FN_NAME(a, b),expected) {
              return "PASSED"
      }
      return "FAILED"
  
  }
  
  func main() {
  
      // Use imports to avoid undefined errors
      var _ = reflect.DeepEqual
      _ = math.Abs
      _ = sort.Sort
      result := ""
      result = driver("fZOKCdZ Lav", 
  	"fKA", 0)
      fmt.Printf("TEST-0...%s\n", result)
      
      result = driver("2", 
  	"187012", 0)
      fmt.Printf("TEST-1...%s\n", result)
      
      result = driver("1000001110", 
  	"0", 6)
      fmt.Printf("TEST-2...%s\n", result)
      
      result = driver("IAOyBzgIWHo", 
  	"oA", 0)
      fmt.Printf("TEST-3...%s\n", result)
      
      result = driver("211806", 
  	"10", 2)
      fmt.Printf("TEST-4...%s\n", result)
      
      result = driver("1", 
  	"001011100", 0)
      fmt.Printf("TEST-5...%s\n", result)
      
      result = driver("CVaQTG", 
  	"CT", 1)
      fmt.Printf("TEST-6...%s\n", result)
      
      result = driver("6265187228", 
  	"628", 6)
      fmt.Printf("TEST-7...%s\n", result)
      
      result = driver("10111101101000", 
  	"01111", 35)
      fmt.Printf("TEST-8...%s\n", result)
      
      result = driver("vEi", 
  	"bigsvkQG", 0)
      fmt.Printf("TEST-9...%s\n", result)
      
          
  }
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 ];
    }