1 #include <stdio.h> 2 #define TABINC 8 3 4 main() 5 { 6 int c, nb, pos; 7 nb = 0; 8 pos = 1; 9 while((c = getchar())!= EOF) 10 { 11 if(c ==' ') 12 { 13 nb = TABINC - (pos - 1) % TABINC; 14 while (nb > 0) 15 { 16 putchar(' '); 17 ++pos; 18 --nb; 19 } 20 }else if(c == ' ') 21 { 22 putchar(c); 23 pos = 1; 24 }else 25 { 26 putchar(c); 27 ++pos; 28 } 29 } 30 }