mirror of
https://github.com/Kiritow/OJ-Problems-Source.git
synced 2024-03-22 13:11:29 +08:00
22 lines
377 B
C++
22 lines
377 B
C++
|
#include <cstdlib>
|
||
|
#include <cstdio>
|
||
|
#include <cstring>
|
||
|
using namespace std;
|
||
|
|
||
|
char buffer[1024];
|
||
|
int main()
|
||
|
{
|
||
|
while(scanf("%s",buffer)==1)
|
||
|
{
|
||
|
int idt=strstr(buffer,"B")-buffer;
|
||
|
int cnt=0;
|
||
|
for(int i=idt-1;i>=0;i--)
|
||
|
{
|
||
|
if(buffer[i]=='(') cnt++;
|
||
|
else cnt--;
|
||
|
}
|
||
|
printf("%d\n",cnt);
|
||
|
}
|
||
|
return 0;
|
||
|
}
|