title: Program Count Occurrence Given Character String
signature: func programCountOccurrenceGivenCharacterString(s string, c rune) int {
test_code: package main
  
  import (
      "fmt"
      "reflect"
      "math"
      "sort"
  )
  
  // SOLUTION CODE
  // ===================================
  PLACEHOLDER_CODE_BODY
  
  // TESTING CODE
  // ===================================
  func validateSolution(actual int, expected int) bool {
      return reflect.DeepEqual(actual,expected)
  }
  
  func driver(s string, c rune, expected int) string {
      if validateSolution(PLACEHOLDER_FN_NAME(s, c),expected) {
              return "PASSED"
      }
      return "FAILED"
  
  }
  
  func main() {
  
      // Use imports to avoid undefined errors
      var _ = reflect.DeepEqual
      _ = math.Abs
      _ = sort.Sort
      result := ""
      result = driver("mhjnKfd", 
  	'l', 0)
      fmt.Printf("TEST-0...%s\n", result)
      
      result = driver("716662107", 
  	'6', 3)
      fmt.Printf("TEST-1...%s\n", result)
      
      result = driver("01", 
  	'1', 1)
      fmt.Printf("TEST-2...%s\n", result)
      
      result = driver("wPHSxIbnHakGRO", 
  	'n', 1)
      fmt.Printf("TEST-3...%s\n", result)
      
      result = driver("721106", 
  	'8', 0)
      fmt.Printf("TEST-4...%s\n", result)
      
      result = driver("111", 
  	'0', 0)
      fmt.Printf("TEST-5...%s\n", result)
      
      result = driver("TIBFU", 
  	'Q', 0)
      fmt.Printf("TEST-6...%s\n", result)
      
      result = driver("0", 
  	'3', 0)
      fmt.Printf("TEST-7...%s\n", result)
      
      result = driver("10", 
  	'0', 1)
      fmt.Printf("TEST-8...%s\n", result)
      
      result = driver("lqq", 
  	'd', 0)
      fmt.Printf("TEST-9...%s\n", result)
      
          
  }
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;
  }