2025-08-02 08:12:11 +0000 UTC
Occurrences After Bigram
Categories:
Links
Code
class Solution:
def findOcurrences(self, text: str, first: str, second: str) -> List[str]:
words = text.split()
length = len(words)
if length < 3:
return []
res = []
i = 0
while i + 2 < length:
if words[i] == first and words[i+1] == second:
res.append(words[i+2])
i += 1
return res