class Solution {
public:
string removeOuterParentheses(string s) {
int n = s.size();
if(n<2)
return ββ;
string out;
stack st;
int balance =0;
int starting =0;
for(int i =0;i<n;i++){
if(s[i]=='(')
st.push(s[i]);
else{
if(st.size()>1)
st.pop();
else
{
if(!st.empty()){
st.pop();
balance = i;
out += s.substr(starting+1,balance-starting-1);
// cout<<balance<<" "<<starting<<endl;
starting = i+1;
//cout<<balance<<" "<<starting<<endl;
}
}
}
}
return out;
}
};
In this code I cannot understand the
//balance = i;
out += s.substr(starting+1,balance-starting-1);
// cout<<balance<<" β<<starting<<endl;
starting = i+1;
//cout<<balance<<β "<<starting<<endl;
//
Please help me here