Print First

Description:

Given a string containing only lower case letters, print first occurrence of all the letters present in that order only Test Case 1 Input (stdin) 3 tamilnadu madam india Expected Output tamilndu mad inda Test Case 2 Input (stdin) 2 sivaramakrishnan welcome Expected Output sivarmkhn welcom

Program :

  • t=int(input())
    while(t>0):
        s=input()
        a=""
        for i in s:
            if i not in a:
                a+=i
        print(a)
        t-=1