🐍 Python Pa help python

Yohan12r

Forum Guru

Create a program that will delete all duplicate characters in a string​

Input starts with a number N and is followed by N strings
Output : Print the character with all the duplicate characters removed.

Sample Input #1​

4
Harrenhal
Drogos
Thoros of Myr
Iron Born

Sample Output #1​


enl
Drgs
ThsfMy
IB
 
Here is a Python program that deletes all duplicate characters in a string based on the provided input format:

Python:
def remove_duplicates(input_string):
    result = ""
    for char in input_string:
        if char not in result:
            result += char
    return result

# Input
n = int(input())
for _ in range(n):
    string = input().strip()
    print(remove_duplicates(string))

You can run this program and input the sample input you provided to get the corresponding output. Let me know if you need further assistance or explanation on how the program works.
 

About this Thread

  • 1
    Replies
  • 350
    Views
  • 1
    Participants
Last reply from:
Unknown user

Trending Topics

Online now

Members online
699
Guests online
5,578
Total visitors
6,277

Forum statistics

Threads
2,350,892
Posts
29,369,151
Members
1,085,971
Latest member
Makoy888777
Back
Top