#K15841. Remove Duplicate Characters
Remove Duplicate Characters
Remove Duplicate Characters
Given a string S, your task is to remove all duplicate characters from the string while preserving the order of their first occurrence. In other words, for each character in the string, if it appears for the first time, keep it; otherwise, ignore it.
For example, if S = "geeksforgeeks"
, the output should be "geksfor"
.
Your solution should read the input from standard input (stdin) and print the result to standard output (stdout).
inputFormat
A single line containing the string S from which duplicate characters need to be removed.
outputFormat
A single line containing the string after removing duplicate characters, preserving the order of their first occurrence.## sample
geeksforgeeks
geksfor