>>740
char buf[1024];
int count=0;
while(fgets(buf,1024,stdin)!=EOF){if(buf[1023]=='\n'){count++;}}
結局改行を数えることになる。