hdu1870

/**/
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cctype>
#include <iostream>
#include <algorithm>
#include <map>
#include <set>
#include <vector>
#include <string>
#include <stack>
#include <queue>

typedef long long LL;
using namespace std;

char s[1005];

int main()
{
	//freopen("in.txt", "r", stdin);
	//freopen("out.txt", "w", stdout);

	while(scanf("%s", s) == 1){
		int len = strlen(s);
		stack<char>st;
		for (int i = 0; i < len; i++){
			if(s[i] == 'B'){
				printf("%d\n", (int)st.size());
				break;
			}else if(s[i] == '('){
				st.push('(');
			}else{
				st.pop();
			}
		}
	}

	return 0;
}
/**/

 

全部评论

相关推荐

点赞 评论 收藏
分享
05-20 13:59
门头沟学院 Java
米黑子米黑子:你这个成绩不争取下保研?
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务