#include <stdio.h>
#include <string.h>
void printMiddleWords(char *str) {
char *words[64];
int count = 0;
// Split the string into words
char *token = strtok(str, " ");
while (token != NULL) {
words[count++] = token;
token = strtok(NULL, " ");
}
if (count % 2 == 0) {
printf("Middle words: %s %s\n", words[count / 2 - 1], words[count / 2]);
} else {
printf("Middle word: %s\n", words[count / 2]);
}
}
int main() {
char str[] = "c++ c java python c# rust";
printMiddleWords(str);
return 0;
}
/*
run:
Middle words: java python
*/