Find Transitive Synonym Groups from Four-Word Contexts

You are given a list of sentences. Each sentence consists of lowercase words separated by spaces and contains no punctuation.

For a word occurrence at position i, if there are at least two words be...

Example

Unlock to view complete problem details

and practice with sample input/output

Was this article helpful?

View Test Cases & Run Code requires membership

Standard Input
Execution Result: