>>146

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

int main(void)
{
char buf[128], *p;
int wc = 0, lc = 0;

while (1) {
printf("行を入力して下さい:");
gets(buf);
if (buf[0] == '\0') break;
lc++;
p = strtok(buf, " .,");
if (p == NULL) continue;
printf("単語:%s ", p);
wc++;
while (p = strtok(NULL, " .,")) {
printf("単語:%s ", p);
wc++;
}
putchar('\n');
}
printf("総行数=%d 総単語数=%d\n", lc, wc);

return 0;
}