A numeric string, , is beautiful if it can be split into a sequence of two or more positive integers, , satisfying the following conditions:
for any (i.e., each element in the sequence is more than the previous element).
No contains a leading zero. For example, we can split into the sequence , but it is not beautiful because and have leading zeroes.
The contents of the sequence cannot be rearranged. For example, we can split into the sequence , but it is not beautiful because it breaks our first constraint (i.e., ).
The diagram below depicts some beautiful strings:
You must perform queries where each query consists of some integer string . For each query, print whether or not the string is beautiful on a new line. If it's beautiful, print YES x, where is the first number of the increasing sequence. If there are multiple such values of , choose the smallest. Otherwise, print NO.
Complete the separateNumbers function in the editor below. It should print a string as described above.
separateNumbers has the following parameter:
s: an integer value represented as a string
The first line contains an integer , the number of strings to evaluate.
Each of the next lines contains an integer string to query.
For each query, print its answer on a new line (i.e., either YES x where is the smallest first number of the increasing sequence, or NO).
Sample Input 0
Sample Output 0
YES 1YES 9YES 99NONONONO
The first three numbers are beautiful (see the diagram above). The remaining numbers are not beautiful:
For , all possible splits violate the first and/or second conditions.
For , it starts with a zero so all possible splits violate the second condition.
For , the only possible split is , which violates the first condition.
For , there are no possible splits because only has one digit.