Andy has the word W and he wants to print the unique characters in the word in the order of their occurrence.write a program to help Andy print the unique characters as described above.
NOTE : consider lower and upper case letters as different
Input
The input is a single line containing the word W.
Output
The output should be a single line containing space separated characters.
Explanation
In the example, the word is MATHEMATICS
The unique characters in the given word are M, A, T, H, E, I, C, S, in the order of occurrence.so the output should be M A T H E I C S.
Sample Input1
MATHEMATICS
Sample Output1
M A T H E I C S
Sample Input2
banana
Sample Output2
b a n
sentense = input()
uniq_chars = []
for char in sentense:
if char not in uniq_chars:
uniq_chars.append(char)
print(" ".join(uniq_chars))
Comments
Leave a comment