Advertisement
Guest User

Untitled

a guest
Dec 9th, 2016
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.50 KB | None | 0 0
  1. #include <stdio.h>
  2. #define IN 1 // w slowie
  3. #define OUT 0 // poza słowem
  4.  
  5. int main() {
  6.  
  7. int c,state;
  8.  
  9. state = OUT;
  10.  
  11. while(c = getchar() != EOF) {
  12.  
  13. if( c == ' ' || c == '\n' || c == '\t') {
  14.  
  15. if(state == IN){
  16.  
  17. putchar('\n'); // koniec slowa
  18. state = OUT;
  19.  
  20. }
  21.  
  22. } else if( state == OUT) {
  23. state = IN;
  24. putchar(c);
  25. } else
  26.  
  27. putchar(c);
  28.  
  29. }
  30.  
  31. }
  32. }
  33. }
  34. return 0;
  35. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement