diff --git a/HDOJ/1870.cpp b/HDOJ/1870.cpp new file mode 100644 index 0000000..5d690e2 --- /dev/null +++ b/HDOJ/1870.cpp @@ -0,0 +1,21 @@ +#include +#include +#include +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; +}