#include<bits/stdc++.h> using namespace std; const int maxl=110; char s[maxl]; stack<int>st; int main(){ cin>>s; for(int i=0;i<strlen(s);i++){ if(s[i]=='(')st.push(s[i]); else { cout<<st.top()<<' '<<i<<endl; st.pop(); } } }
rt,找不出错,输出总是多东西