A character trigram is a group of three consecutive characters as they appear in a word. For example, the word "hello" contains the trigrams "hel", "ell", and "llo".
>>> trigrams('hello') ['hel', 'ell', 'llo'] >>> trigrams('crocodile') ['cro', 'roc', 'oco', 'cod', 'odi', 'dil', 'ile'] >>> trigrams('hi') []
Hint: It may be useful to define another function that checks whether two lists of trigrams have at least a common element
Input The input is a sequence of words, all of them contain only lowercase letters.
Output The output is a list of word pairs that are consecutive in the input sequence and have some common trigram.
Input
bye hello belly mainly finland
Output
hello belly mainly finland
Input
hello hi nope uhm uh belly bye coconut juice
Output
Input
hello
Output
Input
see you later crocodile coconut orinoco megarin nutmeg
Output
crocodile coconut coconut orinoco orinoco megarin megarin nutmeg