java.lang.Object
g1001_1100.s1078_occurrences_after_bigram.Solution

public class Solution extends Object
1078 - Occurrences After Bigram.<p>Easy</p> <p>Given two strings <code>first</code> and <code>second</code>, consider occurrences in some text of the form <code>&quot;first second third&quot;</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>&quot;first second third&quot;</code>.</p> <p><strong>Example 1:</strong></p> <p><strong>Input:</strong> text = &ldquo;alice is a good girl she is a good student&rdquo;, first = &ldquo;a&rdquo;, second = &ldquo;good&rdquo;</p> <p><strong>Output:</strong> [&ldquo;girl&rdquo;,&ldquo;student&rdquo;]</p> <p><strong>Example 2:</strong></p> <p><strong>Input:</strong> text = &ldquo;we will we will rock you&rdquo;, first = &ldquo;we&rdquo;, second = &ldquo;will&rdquo;</p> <p><strong>Output:</strong> [&ldquo;we&rdquo;,&ldquo;rock&rdquo;]</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>
  • Constructor Details

    • Solution

      public Solution()
  • Method Details