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

int main(void) {
    char text[500];
    int count = 0;

    printf("Enter text:\n");
    fgets(text, sizeof(text), stdin);

    char *token = strtok(text, " \n\t");
    while (token != NULL) {
        count++;
        token = strtok(NULL, " \n\t");
    }

    printf("Total number of words: %d\n", count);
    return 0;
}