#C10934. Distinct Split Strings

    ID: 40194 Type: Default 1000ms 256MiB

Distinct Split Strings

Distinct Split Strings

Given a string s, determine whether it can be split into two non-empty parts such that the union of characters in both parts contains at least two distinct characters.

Formally, you're required to verify whether there exists a split of s into u and v (with both u and v non-empty) such that the total set of characters in u and v has size at least 2. This condition simplifies to checking if the entire string contains at least two distinct characters.

Use stdin for input and stdout for output.

inputFormat

The first line contains an integer t (1 ≤ t ≤ 1000), the number of test cases. Each of the next t lines contains a non-empty string s consisting only of lowercase letters. The length of each string does not exceed 1000.

outputFormat

For each test case, output a single line containing "YES" if the string can be split into two parts satisfying the condition; otherwise, output "NO".

## sample
4
abac
abcd
aaaa
abab
YES

YES NO YES

</p>