Removing duplicate characters while preserving order
JavaScript
Medium
strings
Task «Removing duplicate characters while preserving order»
Given a string consisting of lowercase Latin letters. It is necessary to remove all duplicate characters, leaving only the first occurrence of each character. The order of characters must be preserved. Implement a function that takes a string and returns a string without duplicates.
Input Format
One line containing lowercase Latin letters. The length of the string is from 1 to 1000 characters.
Output Format
One line containing the unique characters of the original string in the order of their first appearance.
Examples
Example 1
INPUT
hello
OUTPUT
helo
Example 2
INPUT
aabbcc
OUTPUT
abc
Example 3
INPUT
babad
OUTPUT
bad
main.js