Streaks

In a sequence of words, a word is said to be chained when it starts with the last letter of the previous word.

When kk consecutive words satisfy this condition, we say there is a streak of length kk. For example, given the sequence ["sol", "lobo", "oso", "ojo", "gato"] there is a streak of 4 words from "sol" to "ojo".

Design a function rachas(listapals) that, given a list of words listapals, returns all the streaks appearing in the list, in the order in which they appear. Each streak must be represented as a list of at least two consecutive words that satisfy the chaining condition.

Sample session

Problem information

Author: Unknown
Translator: infbesos

Generation: 2026-04-06T11:40:48.989Z

© Jutge.org, 2006–2026.
https://jutge.org