B - Chat room
Problem description
Vasya has recently learned to type and log on to the Internet. He immediately entered a chat room and decided to say hello to everybody. Vasya typed the word s. It is considered that Vasya managed to say hello if several letters can be deleted from the typed word so that it resulted in the word "hello". For example, if Vasya types the word "ahhellllloou", it will be considered that he said hello, and if he types "hlelo", it will be considered that Vasya got misunderstood and he didn't manage to say hello. Determine whether Vasya managed to say hello by the given word s.
Input
The first and only line contains the word s, which Vasya typed. This word consisits of small Latin letters, its length is no less that 1 and no more than 100 letters.
Output
If Vasya managed to say hello, print "YES", otherwise print "NO".
Examples
Input
ahhellllloou
Output
YES
Input
hlelo
Output
NO
解题思路:题目很简单,就是从给定字符串中从头到尾依次查找是否有"hello"这个单词的每个字符(必须按顺序排列),如果有即为"YES",否则为"NO",简单AC。
AC代码:
#include<bits/stdc++.h>
using namespace std;
int main(){
char obj[]="hello",s[];
int k=;
cin>>s;
for(int i=;s[i]!='\0';++i)
if(obj[k]==s[i])k++;
if(k!=)cout<<"NO"<<endl;
else cout<<"YES"<<endl;
return ;
}
B - Chat room的更多相关文章
- 三周,用长轮询实现Chat并迁移到Azure测试
公司的OA从零开始进行开发,继简单的单点登陆.角色与权限.消息中间件之后,轮到在线即时通信的模块需要我独立去完成.这三周除了逛网店见爱*看动漫接兼职,基本上都花在这上面了.简单地说就是用MVC4基于长 ...
- Socket programing(make a chat software) summary 1:How to accsess LAN from WAN
First we should know some basic conceptions about network: 1.Every PC is supposed to have its own IP ...
- Node聊天程序实例03:chat.js
作者:vousiu 出处:http://www.cnblogs.com/vousiu 本实例参考自Mike Cantelon等人的<Node.js in Action>一书. chat.j ...
- Fake chat script for website download
Are you searching for free fake webchat script then you are at the right place go get download your ...
- IRC(Internet Relay Chat Protocol) Protocal Learning && IRC Bot
catalogue . Abstract . INTRODUCTION . 通信协议Connection Registration Action . 通信协议Channel operations Ac ...
- HDU 5071 Chat(2014鞍山赛区现场赛B题)
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=5071 解题报告:一个管理聊天窗口的程序,一共有八种操作,然后要注意的就是Top操作只是把编号为u的窗口 ...
- ocket.chat 使用 Meteor 开发的实时协作工具,类似 丁丁。
ocket.chat 使用 Meteor 开发的实时协作工具,类似 丁丁. https://rocket.chat/
- 局域网聊天Chat(马士兵视频改进版)
Github地址: https://github.com/BenDanChen/Chat Chat 小小的聊天系统,主要是跟着网上的马士兵老师的公开视频然后再自己反思有什么地方需要改进的地方,然后大体 ...
- Dig out deleted chat messages of App Skype
Last month Candy was arrested on suspicion of having doing online porn webcam shows, but Candy refus ...
- [CareerCup] 8.7 Chat Server 聊天服务器
8.7 Explain how you would design a chat server. In particular, provide details about the various bac ...
随机推荐
- hdu2014 青年歌手大奖赛_评委会打分【C++】
青年歌手大奖赛_评委会打分 Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Tot ...
- JavaScript初步学习----基本使用,简单事件,修改样式,数据类型
JavaScript基本使用 JavaScript原名叫livescript,是一门动态类型,弱类型基于原型的脚本语言 用于页面特效,前后交替,后台开发(node) JavaScript写在s ...
- Leetcode 30.与所有单词相关联的子串
与所有单词相关联的字串 给定一个字符串 s 和一些长度相同的单词 words.在 s 中找出可以恰好串联 words 中所有单词的子串的起始位置. 注意子串要与 words 中的单词完全匹配,中间不能 ...
- RestEasy 用户指南----第4章.使用@Path @GET @POST 等
转载说明出处:http://blog.csdn.net/nndtdx/article/details/6870391 原文地址 http://docs.jboss.org/resteasy/docs/ ...
- 最大公约数和最小公倍数问题 2001年NOIP全国联赛普及组
题目描述 Description 输入二个正整数x0,y0(2<=x0<100000,2<=y0<=1000000),求出满足下列条件的P,Q的个数 条件: 1.P,Q是正整 ...
- CODEVS2144 砝码称重2 (哈希表)
由于m很大,所以不能使用DP. 注意到n≤30,直接暴力2^n会TLE. 所以,将砝码平均分成两份,对一份进行一次暴力,用哈希表存下可能的结果. 对下一份再进行一次暴力,在哈希表中搜索剩余的砝码重量是 ...
- oracle 12c之前用sequence 和 trigger来生成自动增长的列
SQL> create table scott.t1 (id number, val varchar2(8)); Table created. SQL> CREATE SEQUENCE s ...
- HDU 5242 上海大都会 G题
这道题其实是求K条最长的不重叠的链.贪心算法+DFS即可求.深度优先搜索时,返回当前子树的最长链,使用优先队列保存其他孩子结点的最长链,即可.求结果时只需从优先队列中取前K个值的和.这相当于暴力删除每 ...
- maven install:install出现的错误提示
maven install:install出现的错误提示 [INFO] --- maven-install-plugin:2.4:install (default-cli) @ maven028 -- ...
- Kotlin和Java名称的由来
Kotlin和Java名称的由来 学习了:http://blog.jobbole.com/111249/ JetBrains由战斗民族开发: Java来源于印尼群岛中的Java岛: Kotlin来源于 ...