C solution
\nchar * removeOuterParentheses(char * S){\n    char *str = malloc(sizeof(char) * strlen(S));\n    int flag = 0,p = 0;\n    for (int i = 0;i < strlen(S); i++) {
```\nchar * removeOuterParentheses(char * S){\n    char *str = malloc(sizeof(char) * strlen(S));\n    int flag = 0,p = 0;\n    for (int i = 0;i < strlen(S); i++) {\n        if (S[i]==\'(\') {\n            flag++;\n            if (flag != 1) {\n                str[p++] = S[i];\n            }\n        }else{\n            flag--;\n            if(flag!=0){\n                str[p++] = S[i];\n            }\n        }\n    }\n    str[p] = 0;\n    return str;\n}\n```
[]