title: ReverseParentheses - Codefights
body: <p><strong>I'm having a really tough time solving this problem with JavaScript</strong></p>
  <p>You are given a string s that consists of English letters, punctuation marks, whitespace characters and brackets. It is guaranteed that the brackets in s form a regular bracket sequence.</p>
  <p>Your task is to reverse the strings in each pair of matching parenthesis, starting from the innermost one.</p>
  <p>Example</p>
  <p>For string <code>s = a(bc)de</code> the output should be</p>
  <pre><code>reverseParentheses(s) = &quot;acbde&quot;.
  </code></pre>
  <p>Input/Output</p>
  <pre><code>[time limit] 4000ms (js)
  [input] string s
  </code></pre>
  <p>A string consisting of English letters, punctuation marks, whitespace characters and brackets. It is guaranteed that parenthesis form a regular bracket sequence.</p>
  <p>Constraints:</p>
  <p><code>5 ≤ x.length ≤ 55.</code></p>
  <p>[output] string</p>
  <p>It has to work with the following inputs:</p>
  <ol>
  <li><strong>s:</strong> <code>a(bcdefghijkl(mno)p)q</code> <strong>Expected Output:</strong>
  <code>apmnolkjihgfedcbq</code></li>
  <li><strong>s:</strong> <code>co(de(fight)s)</code> <strong>Expected Output:</strong> <code>cosfighted</code></li>
  </ol>