java O(N) one scan no stack
http://www.noteanddata.com/leetcode-1021-Remove-Outermost-Parentheses-java-solution-note.html\n\n\n    public String removeOuterParentheses(String S) {\n       
http://www.noteanddata.com/leetcode-1021-Remove-Outermost-Parentheses-java-solution-note.html\n\n```\n    public String removeOuterParentheses(String S) {\n        int count = 0;\n        int last = 0;\n        StringBuilder sb = new StringBuilder();\n        for(int i = 0; i < S.length(); ++i) {\n            if(S.charAt(i) == \'(\') {\n                count++;\n            }\n            else {\n                count--;\n                if(count == 0) {\n                    sb.append(S.substring(last+1, i));\n                    last = i + 1;\n                }\n            }\n        }\n        return sb.toString();\n    }\n\n```
[]