Simple Java Solution
\nclass Solution {\n    public String removeOuterParentheses(String S) {\n        \n    \tchar [] chars=S.toCharArray();\n    \tStringBuilder sb=new  StringBuil
```\nclass Solution {\n    public String removeOuterParentheses(String S) {\n        \n    \tchar [] chars=S.toCharArray();\n    \tStringBuilder sb=new  StringBuilder();\n    \tStack<Character> st= new Stack<>();\n    \tint startindex=0;\n    \tfor ( int i=0;i<chars.length;i++ ) {\n    \t\tchar c= chars[i];\n    \t\tif(c==\'(\') {\n    \t\t\tst.push(\'(\');\n    \t\t}else if(c==\')\') {\n    \t\t\tst.pop();\n    \t\t}\n    \t\tif(st.isEmpty()) {\n    \t\t\tsb.append(S.substring((startindex+1),i));\n    \t\t\tstartindex=i+1;\n    \t\t}\n    \t\t\n    \t}\n    \t\n        return sb.toString();\n        \n    }\n}\n```
['Java']