title: Program Count Occurrence Given Character String
signature: function program_count_occurrence_given_character_string(s, c)
source_py: def program_count_occurrence_given_character_string(s, c):
      res = 0
      for i in range(len(s)):
          if (s[i] == c):
              res = (res + 1)
      return res
source_cpp: int program_count_occurrence_given_character_string(string s, char c) {
    int res = 0;
    for ( int i = 0;
    i < s . length ( );
    i ++ ) if ( s [ i ] == c ) res ++;
    return res;
  }
question_info.entry_fn_name: program_count_occurrence_given_character_string
question_info.entry_cls_name: Solution
question_info.test_case_ids: ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9']
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(s, c, expected)
      local exec_result;
      local status, error_msg = pcall(function () 
          exec_result=PLACEHOLDER_FN_NAME(s, c) 
      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("mhjnKfd", 'l', 0)
      print(string.format("TEST-0...%s",result))
  
      result = driver("716662107", '6', 3)
      print(string.format("TEST-1...%s",result))
  
      result = driver("01", '1', 1)
      print(string.format("TEST-2...%s",result))
  
      result = driver("wPHSxIbnHakGRO", 'n', 1)
      print(string.format("TEST-3...%s",result))
  
      result = driver("721106", '8', 0)
      print(string.format("TEST-4...%s",result))
  
      result = driver("111", '0', 0)
      print(string.format("TEST-5...%s",result))
  
      result = driver("TIBFU", 'Q', 0)
      print(string.format("TEST-6...%s",result))
  
      result = driver("0", '3', 0)
      print(string.format("TEST-7...%s",result))
  
      result = driver("10", '0', 1)
      print(string.format("TEST-8...%s",result))
  
      result = driver("lqq", 'd', 0)
      print(string.format("TEST-9...%s",result))
  
  end
  
  main()
question_info.test_list: [{"idx": 0, "outputs": 0, "inputs": {"s": "mhjnKfd", "c": "l"}}, {"idx": 1, "outputs": 3, "inputs": {"s": "716662107", "c": "6"}}, {"idx": 2, "outputs": 1, "inputs": {"s": "01", "c": "1"}}, {"idx": 3, "outputs": 1, "inputs": {"s": "wPHSxIbnHakGRO", "c": "n"}}, {"idx": 4, "outputs": 0, "inputs": {"s": "721106", "c": "8"}}, {"idx": 5, "outputs": 0, "inputs": {"s": "111", "c": "0"}}, {"idx": 6, "outputs": 0, "inputs": {"s": "TIBFU", "c": "Q"}}, {"idx": 7, "outputs": 0, "inputs": {"s": "0", "c": "3"}}, {"idx": 8, "outputs": 1, "inputs": {"s": "10", "c": "0"}}, {"idx": 9, "outputs": 0, "inputs": {"s": "lqq", "c": "d"}}]