words. Return every element that appears as a contiguous piece inside some other element of the same list.
"Other" means an element at a different position: if the same word is listed twice, each copy is contained in the other and both belong to the answer.
Each qualifying element is reported as many times as it occurs in words. The answer may come in any order.words=['sunflower', 'flow', 'sun', 'rain'] → ['flow', 'sun']
"flow" and "sun" both appear inside "sunflower", while "rain" and "sunflower" itself are not inside any other word.
words=['cat', 'dog', 'bird'] → []
No word hides inside another, so the answer is empty.
words=['ice', 'rice', 'price'] → ['ice', 'rice']
"ice" sits in both "rice" and "price", and "rice" sits in "price". Both qualify, each listed once.
words.length ≤ 100words[i].length ≤ 30words[i] consists of lowercase English letterswords=['sunflower', 'flow', 'sun', 'rain']
['flow', 'sun']
Run checks the first 3 tests in your browser. Submit checks all 92 tests on the server, hidden ones included.