#include <stdio.h>
int count_occurrences(char s[], char ch) {
int count = 0, i = 0;
while(s[i]) {
if(s[i] == ch) {
count++;
}
i++;
}
return count;
}
int main() {
char s[] = "c c++ c# java php python cobol";
printf("%d\n", count_occurrences(s, 'c'));
printf("%d\n", count_occurrences(s, 'p'));
return 0;
}
/*
run:
4
3
*/