Problem title
Difficulty
Avg time to solve

Coin Game
Easy
15 mins
K Max Sum Combinations
Easy
10 mins
Generate Binary Numbers
Easy
10 mins
Combination Sum
Easy
15 mins
Summed Matrix
Easy
10 mins
Number of rectangles in a grid
Easy
15 mins
Closest Leaf To Given Node In Binary Tree
Moderate
15 mins
Max Stack
Easy
15 mins
Count triplets in a sorted doubly linked list whose sum is equal to a given value x
Moderate
15 mins
Binary Tree Zigzag Traversal
Easy
15 mins
10

Remove Duplicates From String

Difficulty: MEDIUM
Contributed By
Anish De |Level 1
Avg. time to solve
25 min

Problem Statement

You are given a string (STR) of length N, consisting of only the lower case English alphabet.

Your task is to remove all the duplicate occurrences of characters in the string.

For Example:
If the given string is:
abcadeecfb

Then after deleting all duplicate occurrences, the string looks like this:
abcdef
Input Format:
The only input line contains a string (STR).
Output Format:
Print the string after removing all the duplicate occurrences.
Constraints:
1 <= N <= 4*10^5

Time Limit: 1sec
Sample Input 1:
abcadeecfb
Sample Output 1:
abcdef
Sample Input 2:
zzzzzxx
Sample Output 2:
zx
Reset Code
Full screen
copy-code
Console