首页 技术 正文
技术 2022年11月21日
0 收藏 528 点赞 2,980 浏览 1052 个字

CF802G Fake News (easy)

题意翻译

给定一个字符串询问能否听过删除一些字母使其变为“heidi”

如果可以输出“YES”,不然为“NO”

题目描述

As it’s the first of April, Heidi is suspecting that the news she reads today are fake, and she does not want to look silly in front of all the contestants. She knows that a newspiece is fake if it contains heidi as a subsequence. Help Heidi assess whether the given piece is true, but please be discreet about it…

输入输出格式

输入格式:

The first and only line of input contains a single nonempty string ss of length at most 10001000 composed of lowercase letters (a-z).

输出格式:

Output YES if the string ss contains heidi as a subsequence and NO otherwise.

输入输出样例

输入样例#1: 复制

abcheaibcdi

输出样例#1: 复制

YES

输入样例#2: 复制

hiedi

输出样例#2: 复制

NO

说明

A string ss contains another string pp as a subsequence if it is possible to delete some characters from ss and obtain pp .

CF802G Fake News (easy)

#include<queue>
#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
using namespace std;
char ch[];
queue<char> que;
int main() {
que.push('h');que.push('e');que.push('i');
que.push('d');que.push('i');cin>>ch;
int len=strlen(ch);
for(int i=;i<len;i++)
if(!que.empty())
if(ch[i]==que.front())
que.pop();
if(que.empty()) cout<<"YES";
else cout<<"NO";
}
相关推荐
python开发_常用的python模块及安装方法
adodb:我们领导推荐的数据库连接组件bsddb3:BerkeleyDB的连接组件Cheetah-1.0:我比较喜欢这个版本的cheeta…
日期:2022-11-24 点赞:878 阅读:9,027
Educational Codeforces Round 11 C. Hard Process 二分
C. Hard Process题目连接:http://www.codeforces.com/contest/660/problem/CDes…
日期:2022-11-24 点赞:807 阅读:5,518
下载Ubuntn 17.04 内核源代码
zengkefu@server1:/usr/src$ uname -aLinux server1 4.10.0-19-generic #21…
日期:2022-11-24 点赞:569 阅读:6,365
可用Active Desktop Calendar V7.86 注册码序列号
可用Active Desktop Calendar V7.86 注册码序列号Name: www.greendown.cn Code: &nb…
日期:2022-11-24 点赞:733 阅读:6,146
Android调用系统相机、自定义相机、处理大图片
Android调用系统相机和自定义相机实例本博文主要是介绍了android上使用相机进行拍照并显示的两种方式,并且由于涉及到要把拍到的照片显…
日期:2022-11-24 点赞:512 阅读:7,780
Struts的使用
一、Struts2的获取  Struts的官方网站为:http://struts.apache.org/  下载完Struts2的jar包,…
日期:2022-11-24 点赞:671 阅读:4,857