mirror of
				https://gitee.com/coder-xiaomo/leetcode-problemset
				synced 2025-11-04 19:53:12 +08:00 
			
		
		
		
	
		
			
				
	
	
		
			23 lines
		
	
	
		
			1.2 KiB
		
	
	
	
		
			HTML
		
	
	
	
	
	
			
		
		
	
	
			23 lines
		
	
	
		
			1.2 KiB
		
	
	
	
		
			HTML
		
	
	
	
	
	
<p>Given two strings <code>first</code> and <code>second</code>, consider occurrences in some text of the form <code>"first second third"</code>, where <code>second</code> comes immediately after <code>first</code>, and <code>third</code> comes immediately after <code>second</code>.</p>
 | 
						|
 | 
						|
<p>Return <em>an array of all the words</em> <code>third</code> <em>for each occurrence of</em> <code>"first second third"</code>.</p>
 | 
						|
 | 
						|
<p> </p>
 | 
						|
<p><strong>Example 1:</strong></p>
 | 
						|
<pre><strong>Input:</strong> text = "alice is a good girl she is a good student", first = "a", second = "good"
 | 
						|
<strong>Output:</strong> ["girl","student"]
 | 
						|
</pre><p><strong>Example 2:</strong></p>
 | 
						|
<pre><strong>Input:</strong> text = "we will we will rock you", first = "we", second = "will"
 | 
						|
<strong>Output:</strong> ["we","rock"]
 | 
						|
</pre>
 | 
						|
<p> </p>
 | 
						|
<p><strong>Constraints:</strong></p>
 | 
						|
 | 
						|
<ul>
 | 
						|
	<li><code>1 <= text.length <= 1000</code></li>
 | 
						|
	<li><code>text</code> consists of lowercase English letters and spaces.</li>
 | 
						|
	<li>All the words in <code>text</code> a separated by <strong>a single space</strong>.</li>
 | 
						|
	<li><code>1 <= first.length, second.length <= 10</code></li>
 | 
						|
	<li><code>first</code> and <code>second</code> consist of lowercase English letters.</li>
 | 
						|
</ul>
 |