title: Ways Transforming One String Removing 0 Characters
signature: fun waysTransformingOneStringRemoving0Characters(a: String, b: String): Int {
source_py: def ways_transforming_one_string_removing_0_characters(a, b):
      n = len(a)
      m = len(b)
      if (m == 0):
          return 1
      dp = [([0] * (n + 1)) for _ in range((m + 1))]
      for i in range(m):
          for j in range(i, n):
              if (i == 0):
                  if (j == 0):
                      if (a[j] == b[i]):
                          dp[i][j] = 1
                      else:
                          dp[i][j] = 0
                  elif (a[j] == b[i]):
                      dp[i][j] = (dp[i][(j - 1)] + 1)
                  else:
                      dp[i][j] = dp[i][(j - 1)]
              elif (a[j] == b[i]):
                  dp[i][j] = (dp[i][(j - 1)] + dp[(i - 1)][(j - 1)])
              else:
                  dp[i][j] = dp[i][(j - 1)]
      return dp[(m - 1)][(n - 1)]
source_cpp: int ways_transforming_one_string_removing_0_characters(string a, string b) {
    int n = a . size ( ), m = b . size ( );
    if ( m == 0 ) return 1;
    int dp [ m + 1 ] [ n + 1 ];
    memset ( dp, 0, sizeof ( dp ) );
    for ( int i = 0;
    i < m;
    i ++ ) {
      for ( int j = i;
      j < n;
      j ++ ) {
        if ( i == 0 ) {
          if ( j == 0 ) dp [ i ] [ j ] = ( a [ j ] == b [ i ] ) ? 1 : 0;
          else if ( a [ j ] == b [ i ] ) dp [ i ] [ j ] = dp [ i ] [ j - 1 ] + 1;
          else dp [ i ] [ j ] = dp [ i ] [ j - 1 ];
        }
        else {
          if ( a [ j ] == b [ i ] ) dp [ i ] [ j ] = dp [ i ] [ j - 1 ] + dp [ i - 1 ] [ j - 1 ];
          else dp [ i ] [ j ] = dp [ i ] [ j - 1 ];
        }
      }
    }
    return dp [ m - 1 ] [ n - 1 ];
  }
question_info.test_list: [{"idx": 0, "outputs": 3, "inputs": {"a": "abcccdf", "b": "abccdf"}}, {"idx": 1, "outputs": 4, "inputs": {"a": "aabba", "b": "ab"}}, {"idx": 2, "outputs": 1, "inputs": {"a": "aabsdfljk", "b": "aa"}}, {"idx": 3, "outputs": 0, "inputs": {"a": "IONiqV", "b": "XKbBiGZ"}}, {"idx": 4, "outputs": 0, "inputs": {"a": "9667771256770", "b": "50915176"}}, {"idx": 5, "outputs": 11, "inputs": {"a": "10001011", "b": "01"}}, {"idx": 6, "outputs": 0, "inputs": {"a": "fczbDtMDT", "b": "FbX"}}, {"idx": 7, "outputs": 1, "inputs": {"a": "298746088", "b": "29888"}}, {"idx": 8, "outputs": 7, "inputs": {"a": "01100011000", "b": "0"}}, {"idx": 9, "outputs": 1, "inputs": {"a": "Qk", "b": ""}}]
question_info.extension: kts
question_info.test_code: package main
  
  import kotlin.text.*
  import kotlin.math.*
  
  
  // SOLUTION CODE
  // ===================================
  PLACEHOLDER_CODE_BODY
  
  // TESTING CODE
  // ===================================
  fun validateSolution(actual:Int, expected:Int):Boolean{
    return actual.equals(expected)
  }
  fun driver(a: String, b: String, expected:Int):String {
      try{
        if (validateSolution(PLACEHOLDER_FN_NAME(a, b), expected)) {
                return "PASSED"
        }
        return "FAILED"
      } catch (e: Exception){
        return e::class.simpleName as String
      }
  
  }
  
  fun main() {
      var result: String = ""
      result = driver("abcccdf", "abccdf", 3)
      println("TEST-0...${result}")
      
      result = driver("aabba", "ab", 4)
      println("TEST-1...${result}")
      
      result = driver("aabsdfljk", "aa", 1)
      println("TEST-2...${result}")
      
      result = driver("IONiqV", "XKbBiGZ", 0)
      println("TEST-3...${result}")
      
      result = driver("9667771256770", "50915176", 0)
      println("TEST-4...${result}")
      
      result = driver("10001011", "01", 11)
      println("TEST-5...${result}")
      
      result = driver("fczbDtMDT", "FbX", 0)
      println("TEST-6...${result}")
      
      result = driver("298746088", "29888", 1)
      println("TEST-7...${result}")
      
      result = driver("01100011000", "0", 7)
      println("TEST-8...${result}")
      
      result = driver("Qk", "", 1)
      println("TEST-9...${result}")
      
          
  }
  
  main()
question_info.entry_fn_name: waysTransformingOneStringRemoving0Characters
question_info.entry_cls_name: Solution
question_info.test_case_ids: 0 1 2 3 4 5 6 7 8 9
question_info.commands: kotlinc -script __FILENAME__ -no-reflect -nowarn