mirror of
https://github.com/Kiritow/OJ-Problems-Source.git
synced 2024-03-22 13:11:29 +08:00
31 lines
517 B
C++
31 lines
517 B
C++
|
#include <stdio.h>
|
||
|
#include <string.h>
|
||
|
int main()
|
||
|
{
|
||
|
int l;
|
||
|
char a[1000];
|
||
|
while(gets(a))
|
||
|
{
|
||
|
l=strlen(a);
|
||
|
int wbx=0;
|
||
|
int i;
|
||
|
for(i=0;i<l;i++)
|
||
|
{
|
||
|
if(a[i]=='(')
|
||
|
{
|
||
|
wbx++;
|
||
|
}
|
||
|
if(a[i]==')')
|
||
|
{
|
||
|
wbx--;
|
||
|
}
|
||
|
if(a[i]=='B')
|
||
|
{
|
||
|
break;
|
||
|
}
|
||
|
}
|
||
|
printf("%d\n",wbx);
|
||
|
}
|
||
|
return 0;
|
||
|
}
|