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. mysql在windows上安装

    一.在window上安装mysql MySQL是一个小巧玲珑但功能强大的数据库,目前十分流行.但是官网给出的安装包有两种格式,一个是msi格式,一个是zip格式的.很多人下了zip格式的解压发现没有s ...

  2. 【原创】使用HTML5+canvas+JavaScript开发的原生中国象棋游戏及源码分享

    目前已经实现的功能: V1.0 : 实现棋子的布局,画布及游戏场景的初始化V2.0 : 实现棋子的颜色改变V3.0 :实现所有象棋的走棋规则V4.0 : 实现所有棋子的吃子功能 GItHub源码下载地 ...

  3. uva253 Cube painting(UVA - 253)

    题目大意 输入有三种颜色判断两个骰子是否相同 思路(借鉴) ①先用string输入那12个字符,然后for出两个骰子各自的字符串 ②这里用的算法是先找出第一个的三个面与第二个的六个面去比较,如果找到相 ...

  4. Django cookie、session使用

    一.cookie Cookie是key-value结构,类似于一个python中的字典.随着服务器端的响应发送给客户端浏览器.然后客户端浏览器会把Cookie保存起来,当下一次再访问服务器时把Cook ...

  5. JavaScript进阶----关于数字的方法,Math对象,日期对象,定时器,函数,for in

    关于数字的方法: <!DOCTYPE html> <html lang="en"> <head> <meta charset=" ...

  6. JavaSE 学习笔记之Import 导入(十二)

    Import - 导入:类名称变长,写起来很麻烦.为了简化,使用了一个关键字:import,可以使用这个关键字导入指定包中的类.记住:实际开发时,到的哪个类就导入哪个类,不建议使用*. import ...

  7. Grails里DOMAIN类的一对一,一对多,多对多关系总结及集成测试

    终于干完这一章节,收获很多啊. 和DJANGO有类似,也有不同. User.groovy: package com.grailsinaction class User { String loginId ...

  8. Centos6.7搭建ISCSI存储服务器

    https://blog.csdn.net/yuner027/article/details/51925146

  9. Mac OSX:安装zsh

    想在mac下安装oh my zsh,按照https://github.com/robbyrussell/oh-my-zsh上的文档,执行下面这条命令安装:curl -L http://install. ...

  10. ZOJ Monthly, November 2012

    A.ZOJ 3666 Alice and Bob 组合博弈,SG函数应用 #include<vector> #include<cstdio> #include<cstri ...