Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

35 строки
637 B
C++

#include <cstdio>
#include <cstring>
#include <iostream>
const size_t MAX_SIZE = 256;
const char* SEPARATORS = " \r\n,.!?:;()-";
int main() {
char text[MAX_SIZE] = {0};
std::cout << "Enter the line: ";
fgets(text, MAX_SIZE, stdin);
const char* start = text;
while (true)
{
size_t separator_count = strspn(start, SEPARATORS);
start += separator_count;
if (start[0] == '\0')
{
break;
}
size_t word_length = strcspn(start, SEPARATORS);
std::cout.write(start, word_length) << std::endl;
start += word_length;
}
return 0;
}