# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
75098 | 2018-09-08T10:28:14 Z | Yehezkiel | Match (CEOI16_match) | C++11 | 0 ms | 0 KB |
return characters.empty(); } bool possible(){ stack <char> temp; return coba(0,temp); } string makeAns(){ string ret=""; stack <char> characters; for(int i = 0; i < n; i++) { characters.push(input[i]); if(characters.empty()||characters.top() != input[i]) { ret += "("; } else if(coba(i+1,characters)) { ret += "("; } else { characters.pop(); characters.pop(); ret += ")"; } } return ret; } int main() { cin>>input; n = input.length(); if (possible()) { cout<<makeAns()<<endl; } else { printf("-1\n"); } }