title: Program Count Occurrence Given Character String
signature: program_count_occurrence_given_character_string <- function(s, c) {
test_code: 
  
  
  # SOLUTION CODE
  # ============================================
  PLACEHOLDER_CODE_BODY
  
  # TESTING CODE 
  # ============================================
  validate_solution <- function(actual, expected) {
      toString(actual)==toString(expected)
  }
  
  driver <- function(s, c, expected){
      if (validate_solution(PLACEHOLDER_FN_NAME(s, c), expected)){
          "PASSED"
      } else{
          "FAILED"
      }
  }
  
  main <- function() {
      cat(sprintf("TEST-0...%s\n",driver(
          "mhjnKfd", 'l', 
          0L
      )))
  
      cat(sprintf("TEST-1...%s\n",driver(
          "716662107", '6', 
          3L
      )))
  
      cat(sprintf("TEST-2...%s\n",driver(
          "01", '1', 
          1L
      )))
  
      cat(sprintf("TEST-3...%s\n",driver(
          "wPHSxIbnHakGRO", 'n', 
          1L
      )))
  
      cat(sprintf("TEST-4...%s\n",driver(
          "721106", '8', 
          0L
      )))
  
      cat(sprintf("TEST-5...%s\n",driver(
          "111", '0', 
          0L
      )))
  
      cat(sprintf("TEST-6...%s\n",driver(
          "TIBFU", 'Q', 
          0L
      )))
  
      cat(sprintf("TEST-7...%s\n",driver(
          "0", '3', 
          0L
      )))
  
      cat(sprintf("TEST-8...%s\n",driver(
          "10", '0', 
          1L
      )))
  
      cat(sprintf("TEST-9...%s\n",driver(
          "lqq", 'd', 
          0L
      )))
  
  }
  
  main()
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;
  }