input :- The input is a single line containing the word
output :- The output should be a single line containing space-separated characters
if input 1 is :- MATHEMATICS
then output 1 is :- M A T H E I C S
if input 2 is :- banana
then output 2 is :- b a n
#Method_One
print("INPUT: ")
#prompting the user to enter a string
my_string = input("\nEnter your required word: ")
#Check the characters in the word and remove duplicates from the given string, then print the output
print("\nOUTPUT: ")
''.join(sorted(set(my_string), key = my_string.index))
# Method_Two
print("INPUT: ")
#prompting the user to enter a string
my_string = input("\nEnter your required word: ")
#declare a list to store all the characters of the word
my_list = ""
for char in my_string:
if char not in my_list:
my_list = my_list + char
#Check the characters in the word and remove duplicates from the given string, then print the output
print("\nOUTPUT: ")
print(my_list)
Comments
Leave a comment