#K51867. Can the String be Transformed?

    ID: 29183 Type: Default 1000ms 256MiB

Can the String be Transformed?

Can the String be Transformed?

You are given a string ( s ) and are allowed to perform special operations to transform it into its lexicographically smallest permutation. An allowed operation is abstractly defined (for example, reversing any palindromic substring) to help achieve this transformation. In this problem, it has been proven that every string can be transformed into its lexicographically smallest permutation. Your task is simple: For each given string, determine if such a transformation is possible.

Note: In this simplified version of the problem, the answer is always "YES".

inputFormat

The first line of input contains an integer ( T ) denoting the number of test cases. Each of the following ( T ) lines contains a non-empty string ( s ).

outputFormat

For every test case, output a single line with the answer: "YES" if the string can be transformed into its lexicographically smallest permutation, otherwise "NO".

Note: For this problem, it is guaranteed that the answer is always "YES".## sample

3
abba
abc
aabbcc
YES

YES YES

</p>