|
| 1 | +# Question: |
| 2 | + |
| 3 | +# Write a program that accepts a sequence of whitespace separated words as input and prints the words after removing all duplicate words and sorting them alphanumerically. |
| 4 | + |
| 5 | +# Suppose the following input is supplied to the program: |
| 6 | + |
| 7 | +# hello world and practice makes perfect and hello world again |
| 8 | + |
| 9 | +# Then, the output should be: |
| 10 | + |
| 11 | +# again and hello makes perfect practice world |
| 12 | + |
| 13 | +word = sorted(list(set(input().split()))) # input string splits -> converting into set() to store unique |
| 14 | + # element -> converting into list to be able to apply sort |
| 15 | +print(" ".join(word)) |
0 commit comments