Please log in to access this page.

Occurrences After Bigram

Added: 2025-09-12 23:13:32

Question Image

Occurrences After Bigram

Answer

✏️ Edit
text = input().strip()
first = input().strip()
second = input().strip()

words = text.split()
result = []

for i in range(len(words) - 2):
    if words[i] == first and words[i+1] == second:
        result.append(words[i+2])

print('\n'.join(result))