Skip to main content
5 of 7
code revision
breadbox
  • 7.3k
  • 33
  • 45

C, 250 245 236 193 chars

char*p,b[99],a;f(char*s){int t=0;for(;*p-32? *p>47?a=printf(" %d"+!a,strtol(p,&p,10)):*p==40?f(p++),++p: t*(s[t]%5==2|*p%5-2)?printf(" %c",s[t--]):*p>41?s[++t]=*p++:0:++p;);} main(){f(p=gets(b));} 

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

breadbox
  • 7.3k
  • 33
  • 45