#arc163a. [arc163_a]Divide String
[arc163_a]Divide String
Problem Statement
You are given a string of length consisting of lowercase English letters. Determine whether it is possible to divide into two or more consecutive substrings so that they are strictly increasing in lexicographical order.
To be precise, determine whether there is a sequence of strings that satisfies all of the following conditions.
-
The length of the sequence is at least .
-
is not empty. ()
-
Concatenating in this order results in .
-
is lexicographically smaller than for every integer such that .
You are given test cases. Find the answer for each of them.
What is lexicographical order?
A string is said to be lexicographically smaller than a string if either 1. or 2. below holds. Here, and represent the lengths of and , respectively.
- and .
- There is an integer such that both of the following hold.
- .
- The character comes before in alphabetical order.
Constraints
- is a string of length consisting of lowercase English letters.
- The sum of over all test cases in a single input does not exceed .
Input
The input is given from Standard Input in the following format:
Here, represents the -th test case. Each test case is given in the following format:
Output
Print lines.
The -th line should contain Yes
if it is possible to divide in the -th test case into substrings that satisfy the conditions, and No
otherwise.
Sample Input 1
5
4
abac
3
cac
2
ab
12
abababababab
5
edcba
Sample Output 1
Yes
No
Yes
Yes
No
For the first test case, you can divide into a
, ba
, c
.
For the second test case, there is no way to divide into substrings so that they are strictly increasing in lexicographical order.