SPOJ:SQRBR

Any one please help how to solve this problem.
I read the explanation here http://www.quora.com/Can-some-one-explain-how-to-solve-square-brackets-problem-on-spoj-SPOJ-SQRBR but i was not able to understand any one help me .Thanks :)