HQ9+

Practice this coding question on Coding Gurukul.

Problem statement

A programming club demonstrates a tiny language on a classroom projector. Only three instruction characters can produce visible output: uppercase H, uppercase Q and the digit 9. The + instruction may alter an internal counter but does not print anything, and other characters are ignored by this exercise. The teacher wants to decide whether a submitted source line will display anything at all. Your task Inspect the given source string. Print YES if it contains at least one H, Q or 9. Otherwise print NO. You do not need to execute the program, calculate the counter, or generate the text that an output instruction would print. Important details Instruction recognition is case-sensitive. Lowercase h and q do not qualify. A source line consisting only of plus signs produces no output under this rule. Worked example The program ++Q+ includes an uppercase Q, so it will produce output and the answer is YES.

Input format

One nonempty source string with no whitespace.

Output format

Print YES if an output instruction exists, otherwise NO.

Constraints

1 <= source length <= 100; visible ASCII characters without whitespace.

Sample input

++Q+

Sample output

YES

Sign in to run or submit a solution in C++, Java or Python.