#include <stdio.h>
#define IN 1
#define OUT 0
int main()
{
int c, state;
state = OUT;
while ((c = getchar()) != EOF) {
if (c == ' ' || c == '\n' || c == '\t') {
//如果是单词分隔符,且state == IN,表明是单词的结束
if (state == IN) {
putchar('\n');
state = OUT;
}
} else if (state == OUT) {
state = IN;
putchar(c);
} else {
putchar(c);
}
}
}
3.以每行一个单词的形式打印其输入
最新推荐文章于 2022-09-05 22:27:39 发布