title: Number Digits Product Two Numbers
signature: function number_digits_product_two_numbers(a, b)
source_py: def number_digits_product_two_numbers(a, b):
      count = 0
      p = abs((a * b))
      if (p == 0):
          return 1
      while (p > 0):
          count = (count + 1)
          p = (p // 10)
      return count
source_cpp: int number_digits_product_two_numbers(int a, int b) {
    int count = 0;
    int p = abs ( a * b );
    if ( p == 0 ) return 1;
    while ( p > 0 ) {
      count ++;
      p = p / 10;
    }
    return count;
  }
question_info.test_code: 
  
  -- SOLUTION CODE
  -- ============================================
  PLACEHOLDER_CODE_BODY
  
  -- TESTING CODE 
  -- ============================================
  function isCorrect(actual, expected)
      if type(expected) ~= type(actual) then
          return false
      end
      
      if type(expected) == 'table' then
          for k,v_expected in pairs(expected) do
              
              if actual[k] == nil then
                  return false
              end
              local v_actual = actual[k]
              if not isCorrect(v_actual, v_expected) then
                  return false
              end
              actual[k]=nil
          end
      
          if next(actual) then 
              return false
          end
          return true
      else
          return actual == expected
      end
  end
  
  function validateSolution(actual, expected)
      return isCorrect(actual,expected)
  end
  
  function driver(a, b, expected)
      local exec_result;
      local status, error_msg = pcall(function () 
          exec_result=PLACEHOLDER_FN_NAME(a, b) 
      end)
      if status then
          if validateSolution(exec_result,expected) then
              return "PASSED"
          end
          return "FAILED"
      else
          return string.format("ERROR=%s",string.gsub(error_msg,".*:[%d]+: ",""))
      end
  end
      
  function main()
      result = driver(86, 39, 4)
      print(string.format("TEST-0...%s",result))
  
      result = driver(81, 87, 4)
      print(string.format("TEST-1...%s",result))
  
      result = driver(48, 84, 4)
      print(string.format("TEST-2...%s",result))
  
      result = driver(64, 80, 4)
      print(string.format("TEST-3...%s",result))
  
      result = driver(56, 20, 4)
      print(string.format("TEST-4...%s",result))
  
      result = driver(5, 70, 3)
      print(string.format("TEST-5...%s",result))
  
      result = driver(25, 13, 3)
      print(string.format("TEST-6...%s",result))
  
      result = driver(94, 83, 4)
      print(string.format("TEST-7...%s",result))
  
      result = driver(5, 55, 3)
      print(string.format("TEST-8...%s",result))
  
      result = driver(46, 46, 4)
      print(string.format("TEST-9...%s",result))
  
  end
  
  main()
question_info.entry_cls_name: Solution
question_info.test_list: [{"idx": 0, "outputs": 4, "inputs": {"a": 86, "b": 39}}, {"idx": 1, "outputs": 4, "inputs": {"a": 81, "b": 87}}, {"idx": 2, "outputs": 4, "inputs": {"a": 48, "b": 84}}, {"idx": 3, "outputs": 4, "inputs": {"a": 64, "b": 80}}, {"idx": 4, "outputs": 4, "inputs": {"a": 56, "b": 20}}, {"idx": 5, "outputs": 3, "inputs": {"a": 5, "b": 70}}, {"idx": 6, "outputs": 3, "inputs": {"a": 25, "b": 13}}, {"idx": 7, "outputs": 4, "inputs": {"a": 94, "b": 83}}, {"idx": 8, "outputs": 3, "inputs": {"a": 5, "b": 55}}, {"idx": 9, "outputs": 4, "inputs": {"a": 46, "b": 46}}]
question_info.extension: lua
question_info.entry_fn_name: number_digits_product_two_numbers
question_info.test_case_ids: 0 1 2 3 4 5 6 7 8 9
question_info.commands: lua __FILENAME__