OK

Points: 1 (partial)
Time limit: 3.0s
Memory limit: 512M

Author:
Problem type

A string is OK iff it contains the letter O followed (not necessarily directly) by the letter K. For example, the string HKELLO is not OK, but the string HELLOWORLDK is OK.

Input Specification

The first line contains an integer $$T$$, the number of test cases to follow. The next $$T$$ lines each contain a string $$S$$ containing only uppercase English letters. Each such line defines a test case.

Output Specification

For each each test case, output a single line containing either YES if the string is OK, or NO otherwise.

Bounds

Note this problem includes sub-problems of increasing difficulty worth different numbers of points:

• 40 points: $$1 \leq |S| \leq 2000$$
• 100 points: $$1 \leq |S| \leq 100000$$

For all sub-problems:

$$1 \leq T \leq 10$$

Sample Input

3
AOK
KKAAOO
UBJDVODFHFDODJFDBFKDHFB

Sample Output

YES
NO
YES