Friday, February 1, 2019

Print First

  • Problem Description

    Given a string containing only lower case letters, print first occurrence of all the letters present in that order only
  • CODING ARENA
  • t=int(input())
    while(t>0):
        s=input()
        a=""
        for i in s:
            if i not in a:
                a+=i
        print(a)
        t-=1

  • 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

No comments:

Post a Comment