Responsive image

问题 2135 --The parentheses touch each other

2135: The parentheses touch each other

时间限制: 1 Sec  内存限制: 128 MB
提交: 118  解决: 33
[提交][状态][讨论版][命题人:]

题目描述

Here's a string that asks you to find out how many pairs of "()" there are.The string may contain Spaces.

For example:”((lele) love (xxn))”. It contains three pairs of "()"

But: “)aaa(xxn love too)(“ there is only one "()" in it.

And: “(www(aa)(” there is only one "()" in it too.

输入描述

There are n lines of input, the first line is the number n, and then there are n lines of string, each of which may contain Spaces.



输出描述

For each line of string, output the "()" logarithm

样例输入

3
a(love ((lele) b)
b(you c()an do it)()y(e
(new (fa)ce( (hello))a)

样例输出

2
3
4

来源

[提交][状态]
ACM算法攻关部