Back and forth by smkt (333)

#define P printf
int S,m,l,c,w;char*Y(char*s){w=strlen(s);for(l=w/2;l--;)c=s[l],s[l]=s[w-1-l],s[w-1-l]=c;return s;}main(){char n[999],*s,*v=" ";m=S=0;while(gets(n)){s=strtok(n,v);do{if(!S){for(l=m;l--;)P(v);m+=P("%s\n",s)-1;s=strtok(0,v);}S=0;if(!s){S=1;break;}m-=strlen(s);for(l=m;l--;)P(v);P("%s\n",Y(s));s=strtok(0,v);}while(s);}}

Note that non-ascii characters in the above source code will be escaped (such as \x9f).

download

return to the top page