def check_repeated_letters(word): for i in range(len(word) - 1): if word[i] == word[i+1]: return True return False
def get_words_with_repeated_letters(sentence): words = sentence.split() result = [] for word in words: if check_repeated_letters(word): result.append(word) return ' '.join(result)
input_string = input("Введите строку: ") result_string = get_words_with_repeated_letters(input_string) print("Строка слов с повторяющимися буквами: ", result_string)