Tried | instead of +, but surprisingly the runtime increases by 0.003s.
This one went through after multiple tries and getting WAs. It wasn't the logic that went wrong but the OJ's testcase has more than 128 trailing spaces in the first line following the number of test cases! Fixed after string size was made 1024 instead of 129.

Details at: http://linuxwise.blogspot.in/2013/08/acm-uva-673-parenthesis-balance.html