#include <stdio.h>
#include <string.h>
void PrintWordsEndingWithS(char str[], char* delimiter) {
char* word = strtok(str, delimiter);
while (word != NULL) {
if (word[strlen(word) - 1] == 's') {
puts(word);
}
word = strtok(NULL, delimiter);
}
}
int main(void)
{
char s[] = "c lens c++ news java chess";
PrintWordsEndingWithS(s, " ");
return 0;
}
/*
run:
lens
news
chess
*/