23 lines
363 B
C++
23 lines
363 B
C++
|
#include <iostream>
|
||
|
#include <string>
|
||
|
using namespace std;
|
||
|
|
||
|
string s;
|
||
|
int n;
|
||
|
int ans;
|
||
|
|
||
|
int main(){
|
||
|
cin>>s;
|
||
|
for (int i=0; i<s.length(); i++) {
|
||
|
if (s[i]=='(') {
|
||
|
n++;
|
||
|
}
|
||
|
if (s[i]==')') {
|
||
|
if (n==0) {
|
||
|
ans++;
|
||
|
}
|
||
|
n--;
|
||
|
}
|
||
|
}
|
||
|
cout<<ans-n<<" "<<ans<<" "<<n<<endl;
|
||
|
}
|