def replace(self, input_words: Sequence[str]) -> Sequence[str]:
    input_words = tuple(input_words)
    output_words = []
    first_word_i = 0
    while (first_word_i < len(input_words)):
        first_word = input_words[first_word_i]
        next_word_i = (first_word_i + 1)
        for (n_next, phrases_n_next) in self.phrase_index.get(first_word, []):
            continuation = input_words[next_word_i:(next_word_i + n_next)]
            if (continuation in phrases_n_next):
                output_words.append(phrases_n_next[continuation])
                first_word_i += (1 + n_next)
                break
        else:
            output_words.append(first_word)
            first_word_i += 1
    return output_words
def replace(self, input_words: Sequence[str]) -> Sequence[str]:
    input_words = tuple(input_words)
    output_words = []
    first_word_i = 0
    while (first_word_i < len(input_words)):
        first_word = input_words[first_word_i]
        next_word_i = (first_word_i + 1)
        for (n_next, phrases_n_next) in self.phrase_index.get(first_word, []):
            continuation = input_words[next_word_i:(next_word_i + n_next)]
            if (continuation in phrases_n_next):
                output_words.append(phrases_n_next[continuation])
                first_word_i += (1 + n_next)
                break
        else:
            output_words.append(first_word)
            first_word_i += 1
    return output_words