已经连续UKE好几次了!!!
#include<bits/stdc++.h>
using namespace std;
string s;
int check(){
stack<char>h;
int cnt=0;
for(int i=0;i<s.size();i++){
if(s[i]==')'){
if(!h.empty()){
if(h.top()=='('){
h.pop();
cnt++;
}
}
}
else{
h.push(s[i]);
}
}
return cnt;
}
int main(){
cin>>s;
cout<<check()*2;
return 0;
}