Advertisement
allocator

Untitled

Nov 21st, 2011
3,126
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.     char ch = ' ';
  2.     bool First = 1;
  3.     bool last = 1;
  4.     while (true){
  5.         list *a = ListCreate();
  6.         while (ch == ' ')
  7.             scanf("%c", &ch);
  8.         int len = 0;
  9.         while (ch != ' ' && ch != '.'){
  10.             ++len;
  11.             ListAppend(a, ch);
  12.             scanf("%c", &ch);
  13.         }
  14.         int block = len;
  15.         if (len > 1 && First == 0)
  16.             printf(" ");
  17.         last = !(len > 1);
  18.         First = 0;
  19.         if (len % 2 == 1)
  20.             block = len / 2;
  21.         int cnt = 0;
  22.         for (list_item *it = a->head; it; it = it->next, ++cnt)
  23.             if (cnt != block)
  24.                 printf("%c", it->key);
  25.        
  26.         ListFree(a);
  27.         if (ch == '.'){
  28.             printf(".");
  29.             break;
  30.         }
  31.     }
  32.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement