RT
#include<bits/stdc++.h>
#define ll long long
using namespace std;
string s;
stack<char>s1;
ll cnt;
int main()
{
cin>>s;
for(int i=0;i<s.length();i++)
{
if(s[i]=='(')s1.push(s[i]);
if(s[i]==')')
{
if(s1.top()=='(')s1.pop();
else s1.push(s[i]);
}
}
cout<<s1.size();
return 0;
}
https://iai.sh.cn/problem/614