Challenge: Remove Duplicates
Completed
Read a line of words and print each word only once, keeping the order in which they first appeared.
Input
One line of words separated by spaces.
Output
The unique words on one line, separated by spaces.
Example
Input
red blue red green blue
Output
red blue green
Editor
Python
Hints
Start with an empty list.
Only append a word if it is not in the list yet.
" ".join(list) makes the line.
Solution explanation
We keep a list of words we've already seen and only add a word the first time it appears.
Show solution
seen = []
for word in input().split():
if word not in seen:
seen.append(word)
print(" ".join(seen))