Answer to Question #282663 in Python for reddy

Question #282663

Distinct Characters


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 output 2 : b a n


1
Expert's answer
2021-12-27T08:41:13-0500
string=str(input())
 
for i in range(0, len(string)):
    f=0
    for j in range(0, len(string)):
        
        if(string[i]==string[j] and i!=j):
            f=1
            break
    if(f==0):
        print(string[i],end="")

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS