
15 Dec
2007
15 Dec
'07
3:28 p.m.
dons:
bulat.ziganshin:
Hello Don,
Saturday, December 15, 2007, 10:57:02 PM, you wrote:
Do you have the single loop C program, btw? I'd be curious to see if this is really "feasible". It would have to do the buffering, tokenising and accumulating in one go. I'd imagine it is a bit hairy.
for (int n; n = read (0, buf, 32768);) { for (char *p=buf,*end=buf+n;;) while (*p++==' ') if(p==end) goto end; while (*p++!=' ') if(p==end) goto end; words++; } end:; }
Oh, this isn't the original program, either. You need to find the longest word and print it. Not count the words. -- Don