c;t;main(n){for(;(c=getchar())>0;n++)putchar((t+=c)/n+(t%n>n/2));}
StackExchange
Scccd_ccccddd
The brand new service which powers Ideone!
Widget for compiling and running the source code in a web browser!