mirror of
https://gitee.com/coder-xiaomo/leetcode-problemset
synced 2025-09-05 23:41:41 +08:00
update
This commit is contained in:
38
leetcode/problem/goal-parser-interpretation.html
Normal file
38
leetcode/problem/goal-parser-interpretation.html
Normal file
@@ -0,0 +1,38 @@
|
||||
<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> </p>
|
||||
<p><strong>Example 1:</strong></p>
|
||||
|
||||
<pre>
|
||||
<strong>Input:</strong> command = "G()(al)"
|
||||
<strong>Output:</strong> "Goal"
|
||||
<strong>Explanation:</strong> The Goal Parser interprets the command as follows:
|
||||
G -> G
|
||||
() -> o
|
||||
(al) -> al
|
||||
The final concatenated result is "Goal".
|
||||
</pre>
|
||||
|
||||
<p><strong>Example 2:</strong></p>
|
||||
|
||||
<pre>
|
||||
<strong>Input:</strong> command = "G()()()()(al)"
|
||||
<strong>Output:</strong> "Gooooal"
|
||||
</pre>
|
||||
|
||||
<p><strong>Example 3:</strong></p>
|
||||
|
||||
<pre>
|
||||
<strong>Input:</strong> command = "(al)G(al)()()G"
|
||||
<strong>Output:</strong> "alGalooG"
|
||||
</pre>
|
||||
|
||||
<p> </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>
|
Reference in New Issue
Block a user