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

~/algor $ cat problems/string-birinchi-takrorlangan-harf

First repeated letter

Easy 1000 ms 64 MB 29%
Share

A string $s$ is given. Reading it left to right, find the first letter that has already occurred before. If there is no such letter (all letters are distinct), print NO.

The letters of the string: the first letter met a second time is joined by an arc to its earlier occurrence

Input

One line containing the string $s$.

Output

One letter or NO.

Note

$1 \le |s| \le 10^{5}$
$s$ consists of lowercase Latin letters (a–z) only

Examples

Input #1
dasturlash
Output #1
a
Input #2
olma
Output #2
NO

Sign in to submit a solution

Signing up is free and takes a minute.