mirror of
https://gitee.com/coder-xiaomo/leetcode-problemset
synced 2025-01-10 18:48:13 +08:00
33 lines
1.4 KiB
HTML
33 lines
1.4 KiB
HTML
<p>给出第一个词 <code>first</code> 和第二个词 <code>second</code>,考虑在某些文本 <code>text</code> 中可能以 <code>"first second third"</code> 形式出现的情况,其中 <code>second</code> 紧随 <code>first</code> 出现,<code>third</code> 紧随 <code>second</code> 出现。</p>
|
||
|
||
<p>对于每种这样的情况,将第三个词 "<code>third</code>" 添加到答案中,并返回答案。</p>
|
||
|
||
<p> </p>
|
||
|
||
<p><strong>示例 1:</strong></p>
|
||
|
||
<pre>
|
||
<strong>输入:</strong>text = "alice is a good girl she is a good student", first = "a", second = "good"
|
||
<strong>输出:</strong>["girl","student"]
|
||
</pre>
|
||
|
||
<p><strong>示例 2:</strong></p>
|
||
|
||
<pre>
|
||
<strong>输入:</strong>text = "we will we will rock you", first = "we", second = "will"
|
||
<strong>输出:</strong>["we","rock"]
|
||
</pre>
|
||
|
||
<p> </p>
|
||
|
||
<p><strong>提示:</strong></p>
|
||
|
||
<ul>
|
||
<li><code>1 <= text.length <= 1000</code></li>
|
||
<li><code>text</code> 由小写英文字母和空格组成</li>
|
||
<li><code>text</code> 中的所有单词之间都由 <strong>单个空格字符</strong> 分隔</li>
|
||
<li><code>1 <= first.length, second.length <= 10</code></li>
|
||
<li><code>first</code> 和 <code>second</code> 由小写英文字母组成</li>
|
||
<li><code>text</code> 不包含任何前缀或尾随空格。</li>
|
||
</ul>
|