Skip to main content
4 of 7
corrected mispaste
breadbox
  • 7.3k
  • 33
  • 45

C, 250 245 236 chars

char*p,b[64],a;f(char*s){int t=0;for(;;++p)if(*p^32&&!(*p>47? a=printf(" %d"+!a,strtol(p,&p,10)),--p:*p==40&&f(++p))){ while(t*(s[t]^43&&s[t]^45||*p^42&&*p^47))printf(" %c",s[t--]); if(!*p||*p==41)return 1;s[++t]=*p;}}main(){f(p=gets(b));} 

I can remove 7 more chars if we're allowed to have a leading space in the output. Just sayin'.

breadbox
  • 7.3k
  • 33
  • 45