Create 1870.cpp

This commit is contained in:
Kirigaya Kazuto 2016-08-31 15:31:55 +08:00 committed by GitHub
parent 3b6c42acbb
commit cbcc36c153

21
HDOJ/1870.cpp Normal file
View File

@ -0,0 +1,21 @@
#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;
}