//想法极其的惊艳
class Solution {
public:
string removeOuterParentheses(string S) {
int L=1,R=0;
string res;
for(int i=1;i<S.size();i++){
if(S[i] == '(') {
L++;
}else{
R++;
}
if(L != R){
res.push_back( S[i] ) ;
}else{
L=1;
R=0;
i++;
}
}
return res;
}
};