Zebra - also a horse
Very easy
Execution time limit is 0.5 seconds
Runtime memory usage limit is 256 megabytes
A string s
is defined as a zebra if it can be divided into several substrings s = x[1]+x[2]+...+x[k] (k ≥ 1
) such that the following conditions hold:
Each substring x[i] consists of identical characters;
No two substrings x[i] and x[j] (
i ≠ j
) share the same character.
For instance, the string "aaabbccc" qualifies as a zebra, whereas the string "aabbbaa" does not.
You are provided with a string. Determine if it is a zebra.
Input
The first line contains the string s
(1 ≤ |s| ≤ 10^5
). The string consists solely of lowercase Latin letters.
Output
Print "YES" if the string is a zebra, or "NO" if it is not.
Examples
Input #1
Answer #1
Submissions 104
Acceptance rate 50%