You have a string s
that consists of English letters, punctuation marks, whitespace characters, and brackets. It is guaranteed that the parentheses in s
form a regular bracket sequence.
Your task is to reverse the strings contained in each pair of matching parentheses, starting from the innermost pair. The results string should not contain any parentheses.
Example
For string s = "a(bc)de"
, the output should bereverseParentheses(s) = "acbde"
.
Code
function reverseParentheses(s) {
}
'알고리즘(CF)' 카테고리의 다른 글
15. addBorder (1) | 2017.06.17 |
---|---|
14. alternatingSums (1) | 2017.06.17 |
12. sortByHeight (1) | 2017.06.08 |
11. isLucky (1) | 2017.06.08 |
10. commonCharacterCount (1) | 2017.06.08 |