Answered step by step
Verified Expert Solution
Question
1 Approved Answer
HQ 9 + is a joke programming language which has only four one - character instructions: H prints Hello, World!, Q
HQ is a joke programming language which has only four onecharacter instructions:
H prints "Hello, World!",
Q prints the source code of the program itself,
prints the lyrics of Bottles of Beer" song,
increments the value stored in the internal accumulator.
Instructions H and Q are casesensitive and must be uppercase. The characters of the program which are not instructions are ignored.
You are given a program written in HQ You have to figure out whether executing this program will produce any output.
Input
The input will consist of a single line p which will give a program in HQ String p will contain between and characters, inclusive. ASCIIcode of each character of p will be between exclamation mark and tilde inclusive.
Output
Output "YES", if executing the program will produce any output, and NO otherwise
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started