java.lang.Object
g1601_1700.s1678_goal_parser_interpretation.Solution

public class Solution extends Object
1678 - Goal Parser Interpretation.<p>Easy</p> <p>You own a <strong>Goal Parser</strong> that can interpret a string <code>command</code>. The <code>command</code> consists of an alphabet of <code>&quot;G&quot;</code>, <code>&quot;()&quot;</code> and/or <code>&quot;(al)&quot;</code> in some order. The Goal Parser will interpret <code>&quot;G&quot;</code> as the string <code>&quot;G&quot;</code>, <code>&quot;()&quot;</code> as the string <code>&quot;o&quot;</code>, and <code>&quot;(al)&quot;</code> as the string <code>&quot;al&quot;</code>. The interpreted strings are then concatenated in the original order.</p> <p>Given the string <code>command</code>, return <em>the <strong>Goal Parser</strong>&rsquo;s interpretation of</em> <code>command</code>.</p> <p><strong>Example 1:</strong></p> <p><strong>Input:</strong> command = &ldquo;G()(al)&rdquo;</p> <p><strong>Output:</strong> &ldquo;Goal&rdquo;</p> <p><strong>Explanation:</strong> The Goal Parser interprets the command as follows:</p> <p>G -> G</p> <p>() -> o</p> <p>(al) -> al</p> <p>The final concatenated result is &ldquo;Goal&rdquo;.</p> <p><strong>Example 2:</strong></p> <p><strong>Input:</strong> command = &ldquo;G()()()()(al)&rdquo;</p> <p><strong>Output:</strong> &ldquo;Gooooal&rdquo;</p> <p><strong>Example 3:</strong></p> <p><strong>Input:</strong> command = &ldquo;(al)G(al)()()G&rdquo;</p> <p><strong>Output:</strong> &ldquo;alGalooG&rdquo;</p> <p><strong>Constraints:</strong></p> <ul> <li><code>1 <= command.length <= 100</code></li> <li><code>command</code> consists of <code>&quot;G&quot;</code>, <code>&quot;()&quot;</code>, and/or <code>&quot;(al)&quot;</code> in some order.</li> </ul>
  • Constructor Details

    • Solution

      public Solution()
  • Method Details