KnowledgeBoat Logo

Computer Science

Write a Python program to remove duplicate characters of a given string.

Python

Python String Manipulation

2 Likes

Answer

input_string = input("Enter the string: ")
unique_chars = {}
for char in input_string:
    if char not in unique_chars:
        unique_chars[char] = True
result = ''.join(unique_chars.keys())
print(result)

Output

Enter the string: hello world
helo wrd

Answered By

1 Like


Related Questions