title: Count Distinct Occurrences As A Subsequence
signature: pub fn count_distinct_occurrences_as_a_subsequence(s: String, t: String) -> i32 {
test_code: use std::collections::HashMap;
  use std::collections::HashSet;
  use std::cmp::*;
  use std::collections::*;
  use std::fmt::*; 
  
  
  // SOLUTION CODE
  // ============================================
  PLACEHOLDER_CODE_BODY
  
  // TESTING CODE 
  // ============================================
  pub fn validate_solution(actual: i32, expected: i32)->bool{
  return actual==expected
  }
  pub fn driver(s: String, t: String, expected: i32)->String{
      if validate_solution(PLACEHOLDER_FN_NAME(s, t), expected) {
        return "PASSED".to_string();
      };
      return "FAILED".to_string();
  
  }
  
  fn main() {
      println!("TEST-0...{}", driver(
        "banana".to_string(), "ban".to_string(), 
        3
      ));
      
      println!("TEST-1...{}", driver(
        "49597223".to_string(), "42".to_string(), 
        2
      ));
      
      println!("TEST-2...{}", driver(
        "1000010000011".to_string(), "010".to_string(), 
        20
      ));
      
      println!("TEST-3...{}", driver(
        "BTlzufK".to_string(), "EpsVuzP lf".to_string(), 
        0
      ));
      
      println!("TEST-4...{}", driver(
        "3474007".to_string(), "370".to_string(), 
        2
      ));
      
      println!("TEST-5...{}", driver(
        "0010".to_string(), "00000".to_string(), 
        0
      ));
      
      println!("TEST-6...{}", driver(
        "dKHhoTD".to_string(), "doT".to_string(), 
        1
      ));
      
      println!("TEST-7...{}", driver(
        "9123259723".to_string(), "123".to_string(), 
        4
      ));
      
      println!("TEST-8...{}", driver(
        "11001000111110".to_string(), "0".to_string(), 
        6
      ));
      
      println!("TEST-9...{}", driver(
        "iY WJlIZ".to_string(), "iI".to_string(), 
        1
      ));
      
  }
source_py: def count_distinct_occurrences_as_a_subsequence(S, T):
      m = len(T)
      n = len(S)
      if (m > n):
          return 0
      mat = [[0 for _ in range((n + 1))] for __ in range((m + 1))]
      for i in range(1, (m + 1)):
          mat[i][0] = 0
      for j in range((n + 1)):
          mat[0][j] = 1
      for i in range(1, (m + 1)):
          for j in range(1, (n + 1)):
              if (T[(i - 1)] != S[(j - 1)]):
                  mat[i][j] = mat[i][(j - 1)]
              else:
                  mat[i][j] = (mat[i][(j - 1)] + mat[(i - 1)][(j - 1)])
      return mat[m][n]
source_cpp: int count_distinct_occurrences_as_a_subsequence(string S, string T) {
    int m = T . length ( ), n = S . length ( );
    if ( m > n ) return 0;
    int mat [ m + 1 ] [ n + 1 ];
    for ( int i = 1;
    i <= m;
    i ++ ) mat [ i ] [ 0 ] = 0;
    for ( int j = 0;
    j <= n;
    j ++ ) mat [ 0 ] [ j ] = 1;
    for ( int i = 1;
    i <= m;
    i ++ ) {
      for ( int j = 1;
      j <= n;
      j ++ ) {
        if ( T [ i - 1 ] != S [ j - 1 ] ) mat [ i ] [ j ] = mat [ i ] [ j - 1 ];
        else mat [ i ] [ j ] = mat [ i ] [ j - 1 ] + mat [ i - 1 ] [ j - 1 ];
      }
    }
    return mat [ m ] [ n ];
  }