#include #include using namespace std; const int MAX_N=100*1000; int match[MAX_N]; string P; stack S; bool notBalanced; int main() { cin >> P; for(int i=0;i<(int)P.size();i++) { if(P[i]=='(') S.push(i); else{ if(S.empty()){ notBalanced=true; break; } match[i]=S.top(); match[match[i]]=i; S.pop(); } } if(!S.empty()) notBalanced=true; if(notBalanced) cout<<"The Input String is not Balanced !"; else for(int i=0;i<(int)P.size();i++) cout<