Remove Duplicate Letters

medium
1. Given a string s, remove duplicate letters so that every letter appears once and only once.
2. You must make sure your result is the first in dictionary order among all possible results.

Input Format

Input is managed for you

Output Format

Output is managed for you

Constraints

1. 1 <= s.length <= 10^4
2. s consists of lowercase English letters.

Notice

Try First, Check Solution later

1. You should first read the question and watch the question video.
2. Think of a solution approach, then try and submit the question on editor tab.
3. We strongly advise you to watch the solution video for prescribed approach.

Example

Input
bcabc
Output
abc
Previous
Asteroid Collision
Next
Largest Area Histogram 2

Related Questions