Remove Duplicates
Submissions: 14143   Accuracy:

33.98%

  Difficulty: Easy   Marks: 2
     

Given a string, remove duplicates from it. Note that original order of characters must be kept same.  Expected time complexity O(n) where n is length of input string and extra space O(1) under the assumption that there are total 256 possible characters in a string.

Input: First line of the input is the number of test cases T. And first line of test case contains a string.

Output:  Modified string without duplicates and same order of characters.

Constraints:  Input String Length <= 1000

Example:
Input:
2
geeksforgeeks
geeks for geeks

Output:
geksfor
geks for

** For More Input/Output Examples Use 'Expected Output' option **

Author: kartik


Need help with your code? Please use ide.geeksforgeeks.org, generate link and share the link here.

to report an issue on this page.