Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- int main()
- {
- int wordlength, c;
- while((c = getchar()) != EOF)
- {
- if (c == '\n')
- {
- //show the histogram
- }
- else if(c == ' ') // found a new word
- {
- printf("\t%i\n", wordlength);
- wordlength = 0;
- }
- else if (c != ' ') //found a char
- {
- putchar(c);
- ++wordlength;
- }
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement