#include <stdio.h>
#include <string.h>

int main(void) {
    char sentence[100];
    char *words[50];
    int count = 0;

    printf("Enter a line of text: ");
    fgets(sentence, sizeof(sentence), stdin);
    sentence[strcspn(sentence, "\n")] = '\0';

    char *token = strtok(sentence, " ");
    while (token != NULL && count < 50) {
        words[count++] = token;
        token = strtok(NULL, " ");
    }

    printf("Reversed words: ");
    for (int i = count - 1; i >= 0; i--) {
        printf("%s ", words[i]);
    }
    printf("\n");

    return 0;
}