what is the output of the program?
#include stdio.h
#include string.h
// This function counts the number of times the word "sookshmas" appears in a given string
int count_sookshmas(char *string) {
int count = 0;
char *word = strtok(string, " ");
while (word != NULL) {
if (strcmp(word, "sookshmas") == 0) {
count++;
}
word = strtok(NULL, " ");
}
return count;
}
int main(void) {
char string[] = "The word sookshmas appears multiple times in this string. In fact, it appears sookshmas times!";
int sookshmas_count = count_sookshmas(string);
printf("The word 'sookshmas' appears %d times in the string.\n", sookshmas_count);
return 0;
}


Posted on by