fork download
  1. n,p,*t=0,[],0,[],[],[],[]
  2. for b in input():
  3. r=t[ord(b)//30];r+=[n];n+=2
  4. if b in'])}>':p+=[r[-2:]];del r[-2:]
  5. R=range(n-1)
  6. for y in R:print(''.join(' -|+'[sum((y in q)+2*(x in q)for q in p if x>=q[0]<=y<=q[1]>=x)]for x in R))
Success #stdin #stdout 0.02s 9936KB
stdin
[{][<(]})>(())
stdout
+---+                      
|   |                      
| +-+---------+            
| | |         |            
+-+-+         |            
  |           |            
  |   +-----+ |            
  |   |     | |            
  |   | +---+-+---+        
  |   | |   | |   |        
  |   | | +-+-+-+ |        
  |   | | | | | | |        
  |   +-+-+-+ | | |        
  |     | |   | | |        
  +-----+-+---+ | |        
        | |     | |        
        | +-----+ |        
        |         |        
        +---------+        
                           
                    +-----+
                    |     |
                    | +-+ |
                    | | | |
                    | +-+ |
                    |     |
                    +-----+