#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
#include <stdbool.h>
//----------------------------------------------//
bool GetWord(const char text[], const char** begin, const char** end)
{
for (; *text && !isalnum(*text); ++text);
*begin = text;
for (; *text && isalnum(*text); ++text);
*end = text;
return *begin != *end;
}
//----------------------------------------------//
void PrintWords(const char text[])
{
const char* begin;
const char* end;
while (GetWord(text, &begin, &end))
{
fprintf(stdout, "[%.*s]\n", end - begin, begin);
text = end;
}
}
//----------------------------------------------//
#define TEXT_SIZE 256
int main(int argc, const char* argv[])
{
//fprintf(stdout, "input string: ");
char text[TEXT_SIZE] = "Hello World. I Am Student!";
//fgets(text, TEXT_SIZE, stdin);
PrintWords(text);
return EXIT_SUCCESS;
}