fork(2) download
  1. // BrainSteel
  2. // C, 150 bytes
  3. t;f(char*c){char l=strlen(c)+1,o[l*l],*A=o,m=0;for(t=1;t<l*l;t++)o[t-1]=t%l?32:10;for(t=-1;*c;c++)A++[l*(*c-41?++t>m?m=t:t:t--)]=*c;A[m*l]=0;puts(o);}
  4.  
  5. // Test Program:
  6. #include "stdio.h"
  7. #include "string.h"
  8.  
  9. int main(){
  10. char buf[100];
  11. int q = 0;
  12. while (!q) {
  13. scanf(" %99s", buf);
  14. if (strcmp(buf, "quit")) {
  15. printf("%s\n\n", buf);
  16. f(buf);
  17. printf("\n--------------------\n");
  18. }
  19. else q = 1;
  20. }
  21.  
  22. return 0;
  23. }
  24.  
Success #stdin #stdout 0s 2056KB
stdin
()

(((())))

()(())((()))(())()

((()())()(()(())()))

(()(())((()))(((()))))

(()()()(())()()())

quit

stdout
()

()

--------------------
(((())))

(      )
 (    ) 
  (  )  
   ()   

--------------------
()(())((()))(())()

()(  )(    )(  )()
   ()  (  )  ()   
        ()        

--------------------
((()())()(()(())()))

(                  )
 (    )()(        ) 
  ()()    ()(  )()  
             ()     

--------------------
(()(())((()))(((()))))

(                    )
 ()(  )(    )(      ) 
    ()  (  )  (    )  
         ()    (  )   
                ()    

--------------------
(()()()(())()()())

(                )
 ()()()(  )()()() 
        ()        

--------------------