#K81452. Forming the Complete Alphabet
Forming the Complete Alphabet
Forming the Complete Alphabet
In this problem, you are given a string s consisting of lowercase English letters. Your task is to determine whether it is possible to remove exactly one non-empty contiguous substring from s such that the remaining string contains every letter of the English alphabet (i.e. letters from a to z) at least once. In other words, after the removal, the remaining characters must include all 26 letters. Note that the removed substring must be contiguous and non-empty.
Formally, let ( s ) be the input string. You need to check if there exists a pair of indices ( i, j ) with ( 0 \le i \le j < |s| ) such that if the substring from index ( i ) to ( j ) (inclusive) is removed, the resulting string contains each letter in the set ( {a, b, \dots, z} ) at least once. For example, if the input string is
( s = s_1 s_2 \dots s_n ),
after removing the substring ( s_i s_{i+1} \dots s_j ), the remaining string is:
( s_1 s_2 \dots s_{i-1} s_{j+1} s_{j+2} \dots s_n. )
If such a removal is possible, print YES
; otherwise, print NO
.
inputFormat
The input consists of a single line containing a string ( s ) composed of lowercase English letters. The string's length can vary, but it will be sufficient to check for the necessary conditions.
outputFormat
Output a single line: YES
if it is possible to remove exactly one contiguous substring such that the remaining string contains all 26 letters at least once; otherwise, output NO
.## sample
abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz
YES