Problem description

HQ9+ is a joke programming language which has only four one-character instructions:

  • "H" prints "Hello, World!",
  • "Q" prints the source code of the program itself,
  • "9" prints the lyrics of "99 Bottles of Beer" song,
  • "+" increments the value stored in the internal accumulator.

Instructions "H" and "Q" are case-sensitive and must be uppercase. The characters of the program which are not instructions are ignored.

You are given a program written in HQ9+. 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 HQ9+. String p will contain between 1 and 100 characters, inclusive. ASCII-code of each character of p will be between 33 (exclamation mark) and 126 (tilde), inclusive.

Output

Output "YES", if executing the program will produce any output, and "NO" otherwise.

Examples

Input

Hi!

Output

YES

Input

Codeforces

Output

NO

Note

In the first case the program contains only one instruction — "H", which prints "Hello, World!".

In the second case none of the program characters are language instructions.

解题思路:题目的意思就是如果输入字符串中有'H','Q','9'这三个字符中的任意一个,程序都会有输出即为"YES",否则为没有输出即为"NO",注意字符'+'只是内部累加值并不会使程序有输出,所以这种情况不算,简单水过。

AC代码:

 #include<bits/stdc++.h>
using namespace std;
int main(){
char str[];bool flag=false;
cin>>str;
for(int i=;str[i]!='\0';++i){
if(str[i]=='H'||str[i]=='Q'||str[i]==''){flag=true;break;}
}
if(flag)cout<<"YES"<<endl;
else cout<<"NO"<<endl;
return ;
}

A - HQ9+的更多相关文章

  1. Codeforces 133A:HQ9+

    A. HQ9+ time limit per test 2 seconds memory limit per test 256 megabytes input standard input outpu ...

  2. Oracle学习笔记十 使用PL/SQL

    PL/SQL 简介 PL/SQL 是过程语言(Procedural Language)与结构化查询语言(SQL)结合而成的编程语言,是对 SQL 的扩展,它支持多种数据类型,如大对象和集合类型,可使用 ...

  3. Oracle学习笔记九 数据库对象

    Oracle 数据库对象又称模式对象,数据库对象是逻辑结构的集合,最基本的数据库对象是表. 其他数据库对象包括:  

  4. 3.Java网络编程之IP

    前面两篇博文我们已经简单了解了IP.端口.协议以及两种参考模型,我们现在重新从程序角度来看下这个参考模型. 如果我们从事的是Web网站开发,那么我们应该知道HTML是一种超文本标记语言 (Hyper ...

  5. android 性能分析案例

    本章以实际案例分析在android开发中,性能方面的优化和处理.设计到知识点有弱引用,memory monitor,Allocation Tracker和leakcanary插件. 1.测试demo ...

  6. 关于kali2.0rolling中metasploit升级后无法启动问题的解决总结

    最近在学习metasploit的使用,文中提到可以使用msfupdate命令来对metasploit的payload.exploit等进行升级,我就试了一下,没想到升级过程并不麻烦,但升级后却出现了无 ...

  7. Oracle PL/SQL

    PL/SQL 简介 PL/SQL 是过程语言(Procedural Language)与结构化查询语言(SQL)结合而成的编程语言,是对 SQL 的扩展,它支持多种数据类型,如大对象和集合类型,可使用 ...

  8. OAF_开发系列19_实现OAF对话框提示dialogPage(案例)

    20150716 Created By BaoXinjian

  9. OAF_开发系列01_实现OAF资料主从关系Master-Detail联动(案例)

    2014-06-02 Created By BaoXinjian

随机推荐

  1. 最适合初学者的Linux运维学习教程2018版

    Linux运维工程师是一个新颖岗位,现在非常吃香,目前从行业的角度分析,随着国内软件行业不断发展壮大,越来越多复杂系统应运而生,为了保证系统稳定运行,必须要有足够多的Linux运维工程师.维护是软件生 ...

  2. 小白学习Spark系列五:scala解析多级json格式字符串

    一.背景 处理json格式的字符串,key值一定为String类型,但value不确定是什么类型,也可能嵌套json字符串,以下是使用 JSON.parseFull 来解析多层json. 二.实例代码 ...

  3. 优雅的退出/关闭/重启gunicorn进程

    在工作中,会发现gunicorn启动的web服务,无论怎么使用kill -9 进程号都是无法杀死gunicorn,经过我一番百度和谷歌,发现想要删除gunicorn进程其实很简单. 第一步获取Guni ...

  4. Binary search tree system and method

    A binary search tree is provided for efficiently organizing values for a set of items, even when val ...

  5. Java中处理线程同步

    引自:http://blog.csdn.net/aaa1117a8w5s6d/article/details/8295527和http://m.blog.csdn.net/blog/undoner/1 ...

  6. MySQL系列:innodb源码分析 图 ---zerok的专栏

    http://blog.csdn.net/yuanrxdu/article/details/40985363

  7. 使用Visual Studio Code调试Electron主进程

    1.打开VS Code,使用文件->打开,打开程序目录 2.切换到调试选项卡 3.打开launch.json配置文件 4.在“附加到进程”节点上增加localhost配置 5.使用命令行启动el ...

  8. firedac数据集控件的公共祖先类——TFDAdaptedDataSet

    firedac数据集控件的公共祖先类——TFDAdaptedDataSet TFDQuery = class(TFDCustomQuery)TFDCustomQuery = class(TFDRdbm ...

  9. 将XML文件转化成NSData对象

    NSData *xmlData = [[NSData alloc]initWithContentsOfFile:[NSString stringWithFormat:@"%@/People. ...

  10. wait()方法写在while循环中可以在线程接到通知后再一次判断条件

    wait()方法写在while循环中可以在线程接到通知后再一次判断条件 synchronized public String pop() { String returnValue = "&q ...