Skip to main content
Tuesday (24.11.2026) at 20:00: ALGOR Contest: Round #4 (Special Challenge) starts!

~/algor $ cat problems/navbat-birinchi-yagona-harf

First unique letter in a stream

Medium 1000 ms 128 MB 66%
Share

Lowercase Latin letters arrive one at a time; together they form the string $s$. After each letter arrives, determine which of the letters that have occurred exactly once so far arrived first; if there is no such letter, write -. Print the answers as one string.

A stream of letters and a queue: after each step the unique letter at the front of the queue is highlighted

Input

One line with the string $s$.

Output

A string of $|s|$ characters (letters or -).

Note

$1 \le |s| \le 10^{5}$
$s$ consists of lowercase Latin letters

Examples

Input #1
aabcbd
Output #1
a-bbcc
Input #2
z
Output #2
z

Sign in to submit a solution

Signing up is free and takes a minute.