Write a program using the fewest bytes of source code which given a list of strings finds all elements which are still in the list when any character is deleted.
For example, given a list of all English words
boats would be output because
boat are all English words and thus would be in the list.
Simple Pyhon code example, assuming
words is the input list:
for w in words: has_all = True for i in range(len(w)): test = w[:i] + w[i+1:] if test not in words: has_all = False break if has_all print(w)
Example input list with some strings:
aorn (+) aor (+) arn aon orn (+) ao ar or rn on
The strings marked with
(+) are the ones that should be the output.
aon shouldn't be output because we can delete the middle character to get
an, which is not in the input list.
You should test that aba is not present on the output of this list:
aba ba aa b