Advertisement
Guest User

Untitled

a guest
Oct 21st, 2019
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.45 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <ctype.h>
  3.  
  4. void Read()
  5. {
  6.     int c;
  7.     int need_space = 0;
  8.     while((c = getchar()) != EOF)
  9.     {
  10.         if(!isspace(c))
  11.         {
  12.             putchar(c);
  13.             need_space = 1;
  14.         }
  15.         if(isspace(c))
  16.         {
  17.             if(need_space)
  18.             {
  19.                 putchar(' ');
  20.                 need_space = 0;
  21.             }
  22.         }
  23.     }
  24. }
  25.  
  26. int main()
  27. {
  28.     Read();
  29.     return 0;
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement