题解:简单的数括号问题……
#include <cstdio> char s[1005]; int main(){ while(scanf("%s",s)!=EOF){ int top=0; for(int i=0;;i++){ if(s[i]=='B')break; if(s[i]=='(')top++; if(s[i]==')')top--; } printf("%d ",top); } return 0; }