1
0
mirror of https://gitee.com/coder-xiaomo/leetcode-problemset synced 2025-01-10 18:48:13 +08:00
Code Issues Projects Releases Wiki Activity GitHub Gitee
leetcode-problemset/leetcode-cn/problem (Chinese)/设计 Goal 解析器 [goal-parser-interpretation].html
2022-03-29 12:43:11 +08:00

38 lines
1.4 KiB
HTML
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<p>请你设计一个可以解释字符串 <code>command</code><strong>Goal 解析器</strong><code>command</code><code>"G"</code><code>"()"</code> 和/或 <code>"(al)"</code> 按某种顺序组成。Goal 解析器会将 <code>"G"</code> 解释为字符串 <code>"G"</code><code>"()"</code> 解释为字符串 <code>"o"</code> <code>"(al)"</code> 解释为字符串 <code>"al"</code> 。然后,按原顺序将经解释得到的字符串连接成一个字符串。</p>
<p>给你字符串 <code>command</code> ,返回<em> </em><strong>Goal<em><strong> </strong></em>解析器 </strong><em> </em><code>command</code> 的解释结果。</p>
<p> </p>
<p><strong>示例 1</strong></p>
<pre><strong>输入:</strong>command = "G()(al)"
<strong>输出:</strong>"Goal"
<strong>解释:</strong>Goal 解析器解释命令的步骤如下所示:
G -&gt; G
() -&gt; o
(al) -&gt; al
最后连接得到的结果是 "Goal"
</pre>
<p><strong>示例 2</strong></p>
<pre><strong>输入:</strong>command = "G()()()()(al)"
<strong>输出:</strong>"Gooooal"
</pre>
<p><strong>示例 3</strong></p>
<pre><strong>输入:</strong>command = "(al)G(al)()()G"
<strong>输出:</strong>"alGalooG"
</pre>
<p> </p>
<p><strong>提示:</strong></p>
<ul>
<li><code>1 &lt;= command.length &lt;= 100</code></li>
<li><code>command</code><code>"G"</code><code>"()"</code> 和/或 <code>"(al)"</code> 按某种顺序组成</li>
</ul>