XYZ String

2

1 votes
Problem

An XYZ string is a string that starts with XYZ and ends with XYZ.

You wil be given a string check wheather given string can be converted into XYZ or not by shuffling the give string.

If we can get XYZ string by reshuffling print "YES" else Print "NO".

Input :

First line of input contains T denoting no of test cases.

Next T lines will be given a string

Output:

Print "YES" or "NO" for each test case.

Constraints :

1<=T<=40

1<=|S|<=105

Time Limit: 1
Memory Limit: 256
Source Limit:
Explanation

For first test case  we can shuffle it to make "xyzhhpxyz" which is a XYZ so answer is "YES".

For second test case you cant convert it into XYZ string so answer is "NO".

Editor Image

?