Class Solution
java.lang.Object
g1601_1700.s1678_goal_parser_interpretation.Solution
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>"G"</code>, <code>"()"</code> and/or <code>"(al)"</code> in some order. The Goal Parser will interpret <code>"G"</code> as the string <code>"G"</code>, <code>"()"</code> as the string <code>"o"</code>, and <code>"(al)"</code> as the string <code>"al"</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>’s interpretation of</em> <code>command</code>.</p>
<p><strong>Example 1:</strong></p>
<p><strong>Input:</strong> command = “G()(al)”</p>
<p><strong>Output:</strong> “Goal”</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 “Goal”.</p>
<p><strong>Example 2:</strong></p>
<p><strong>Input:</strong> command = “G()()()()(al)”</p>
<p><strong>Output:</strong> “Gooooal”</p>
<p><strong>Example 3:</strong></p>
<p><strong>Input:</strong> command = “(al)G(al)()()G”</p>
<p><strong>Output:</strong> “alGalooG”</p>
<p><strong>Constraints:</strong></p>
<ul>
<li><code>1 <= command.length <= 100</code></li>
<li><code>command</code> consists of <code>"G"</code>, <code>"()"</code>, and/or <code>"(al)"</code> in some order.</li>
</ul>
-
Constructor Summary
Constructors -
Method Summary
-
Constructor Details
-
Solution
public Solution()
-
-
Method Details
-
interpret
-