(* count number of occurrences of char x in string s *) let rec strcount x s = (if (String.length s = 1) then 0 else (strcount x (String.sub s 1 ((String.length s)-1)))) + (if (s.[0] = x) then 1 else 0) ;;