-
Профи
(646)
2 недели назад
def find_life(text):
words = text.lower().split()
result = set()
for word in words:
if len(set(word)) != len(word):
result.add(word)
return result
text = "One of the most interesting features of life is where it manages to exist"
print(*find_life(text), sep='\n')
text = "It glows everywhere everywhere the fish living completely Indifferent to which part of the body to swim forward Go forward forever"
print(*find_life(text), sep='\n')
Живыми будем считать слова, в которых есть повторяющиеся буквы – не важно, в каком регистре. Найдите в строках все такие слова, соберите вместе, но не повторяйтесь! И выведите по одному в строке в любом порядке.
Формат ввода
Вводятся строки слов, записанных через пробел.
Формат вывода
Выведите найденные слова, как описано в условии.
Пример 1
Ввод:
One of the most interesting features of life
is where it mAnages to exist
Вывод:
features
interesting
mAnages
where
Пример 2
Ввод:
It glows everywhere
everywhere the fish living
completely Indifferent
to which part of the body to swim forward
Go forward forever
Вывод:
Indifferent
completely
everywhere
forever
forward
living
which