题目
#include <iostream>
#include <algorithm>
using namespace std;
int main() {
string s;
cin>>s;
int len=s.length();
int ans=0;
int arr[len+3]={0}; //记录下标
int l=0;
int r=len-1;
while (l<r) {
while (l<len&&s[l]==')') { //从第一个(开始
l++;
}
while (r>=0&&s[r]=='(') { //从最后一个)开始
r--;
}
if (s[l]=='('&&s[r]==')'&&l<r) { //若为简单字符串
ans+=2;
arr[l+1]=l+1;
arr[r+1]=r+1;
l++;
r--;
}
}
sort(arr+1,arr+len+1);
if (ans==0) {
cout<<'0';
} else {
cout<<'1'<<"\n";
cout<<ans<<"\n";
int t=1;
while (arr[t]==0) { //去0
t++;
}
for (int i=t;i<ans+t;i++) {
cout<<arr[i];
if (i!=ans+t) {
cout<<' ';
}
}
}
return 0;
}