2024-04-21 09:25:27 -04:00
|
|
|
#include <stdio.h>
|
|
|
|
|
|
|
|
#define IN 1
|
|
|
|
#define OUT 0
|
|
|
|
|
2024-05-02 09:52:00 -04:00
|
|
|
// converting input string to one word per line
|
|
|
|
|
2024-04-21 09:25:27 -04:00
|
|
|
main()
|
|
|
|
{
|
|
|
|
int c, state, word_ending;
|
|
|
|
state = 0;
|
|
|
|
while ((c = getchar()) != EOF)
|
|
|
|
{
|
|
|
|
word_ending = (c == ' ' || c == '\n' || c == '\t');
|
|
|
|
if (state == IN)
|
|
|
|
{
|
|
|
|
if (word_ending)
|
|
|
|
{
|
|
|
|
state = OUT;
|
|
|
|
putchar('\n');
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
putchar(c);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (!word_ending)
|
|
|
|
{
|
|
|
|
state = IN;
|
|
|
|
putchar(c);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|