题目描述

You are given a string S consisting of lowercase English letters. Another string T is initially empty. Determine whether it is possible to obtain S=T by performing the following operation an arbitrary number of times:
Append one of the following at the end of T: dream, dreamer, erase and eraser.

Constraints
1≤|S|≤105
S consists of lowercase English letters.

输入

The input is given from Standard Input in the following format:
S

输出

If it is possible to obtain S=T, print YES. Otherwise, print NO.

样例输入

erasedream

样例输出

YES

提示

Append erase and dream at the end of T in this order, to obtain S=T.

题意很简单,就是判断S字符串是不是有那四个单词组成,orz很水的题,可是当时写的时候比较卡。

那么我们就从字符串后面判断,如果有匹配的就删去就好了(你说为什么不从前面?dreamer 和erase、eraser 。我怎么知道该删的是dreamer 还是 dream,说不定后面有个erase或者eraser呢)

删除的话用 string.erase(pos,nops);

当然用 substr(pos,nops)把前面的不删除串赋值给原串也可以

 #include<bits/stdc++.h>
using namespace std; int main()
{
string word;
cin>>word;
string a = "dreamer";
string b = "dream";
string c = "eraser";
string d = "erase";
int flag = ;
while(flag)
{
flag = ;
int len = word.length();
if(len < )break; if((word.compare(len-,len,b)==) || (word.compare(len-,len,d)==))
{
word.erase(len-,len);
flag = ;
continue;
}
if((word.compare(len-,len,c)==))
{
word.erase(len-,len);
flag = ;
continue;
}
if((word.compare(len-,len,a)==))
{
word.erase(len-,len);
flag = ;
continue;
}
}
if(word.length() == )printf("YES\n");
else printf("NO\n");
}

6491: Daydream的更多相关文章

  1. DayDream, 移动VR 2.0里程碑: 概述(上篇)

    VR设备, 断断续续使用了很多个; 尤其是最近半年,主要是PC VR方面项目. 以前对移动VR不感冒,这几天试用了一下DayDream, 眼前突然一亮, 就如同年初首次使用HTC Vive眼前一亮的感 ...

  2. 关于Daydream VR的最直白的介绍

    虚拟现实(Virtual Reality),简称虚拟技术,也称虚拟环境,是利用电脑模拟产生一个三度空间的虚拟世界,提供用户关于视觉等感官的模拟,让用户如同身历其境一般,电脑可以立即进行复杂的运算,将精 ...

  3. Google Daydream 在中国的第一次演讲摘录

    从 PC.手机到 VR/AR,计算机平台正在迁移,而在这个过程中,与用户使用体验息息相关的「人机交互方式」也将不可避免的发生变化.作为这几波浪潮的弄潮儿,Google 怎么看这种人机交互方式的演进? ...

  4. 基于Daydream technical preview GVR13开发Daydream,Cardboard的Android应用

    本文用Unity的Daydream Preview GVR13版本开发同时兼容Daydream和Cardboard的Android应用,Android Studio版本为2.2.3. 下载最新Dayd ...

  5. Android - Daydream 互动屏保

    Android Daydream 互动屏保 API19 API23 Create:2016-03-01 继承DreamService来实现一个自定义屏保 Dreams是当充电的设备空闲,或者插入底座时 ...

  6. hdu_2668 Daydream O(n)求最长不重复子串

    题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=2668 Daydream Time Limit: 2000/1000 MS (Java/Others)  ...

  7. Unity3d外包公司|UE4外包公司:谷歌首款Daydream VR设备上手

    这款售价仅为79美元(约合人民币525元)的产品内含“够用”的手柄和一台头戴设备,只要你有一台支持月日,10月5日,dream平台的手机(未来将成为安卓平台的标配),就能体验VR的乐趣. 即使该产品最 ...

  8. How do I install Daydream on my phone?

    Google's philosophy with their newest VR platform is simple. In order to offer the best possible exp ...

  9. Daydream Controller手柄数据的解析

    参考: How I hacked Google Daydream controller How I hacked Google Daydream controller (Part IV) 反编译代码: ...

随机推荐

  1. 高性能MySQL(第3版) 中文PDF带目录清晰版

    下载地址: <高性能MySQL(第3版)>编辑推荐:"只要你不敢以MySQL专家自诩,又岂敢错过这本神书?""一言以蔽之,写得好,编排得好,需要参考时容易到爆 ...

  2. Oracle imp exp 导入导出 执行脚本

    一:用命令 imp/exp 的方式进行数据的导入和导出 一:文件后缀名: 二:oracle  导出 exp 命令 echo 开始备份数据库 if not exist D:\oracle_bak\fil ...

  3. centos 7.3 设置静态IP

    注:本文来源:张亮博客  的 <centos 7.3 设置静态IP或ping 报name or service not known> 首先把虚拟机配置为桥接模式,然后开启再你打算修改虚拟机 ...

  4. Confluence 6 SQL Server 输入你的数据库细节

    Confluence 的安装向导将会指导你一步一步的在 Confluence 中配置安装 SQL Server 数据库. 使用 JDBC 连接(默认) JDBC 是推荐的连接你的 Confluence ...

  5. 在线版区间众数 hzw的代码。。

    /* 查询区间众数,要求强制在线 设有T个块 1.众数只可能在大块[L,R]里或者两端[l,L) (R,r]里出现 2.大块的众数只要预处理打表一下即可,复杂度n*T(这样的区间有T*T个) 3.两端 ...

  6. node.js 的页面渲染方法ejs

    .安装依赖的组件 npm i consolidate -D npm i ejs -D 2.布局服务端 const express = require('express'); const consoli ...

  7. Oracle logminer 日志挖掘

    Table of Contents 1. LOGMNR简介 2. 创建数据字典 2.1. 外部文件存储数据字典 2.2. redo log 存储数据字典 3. 添加需要分析的文件 4. 开始分析文件 ...

  8. 爬取文件时,对已经操作过的URL进行过滤

    爬取文件时,对已经操作过的URL进行过滤 1.创建过滤规则文件filter.py在spiders同级目录 class RepeatUrl: def __init__(self): self.visit ...

  9. H5实现轮播

    页面代码: <div id="body_wrapper" class="container"> <article> <sectio ...

  10. 通过expdp和impdp将Oracle11g数据导入到Oracle10g中

    1 导出过程 1.1 查看目录: select * from dba_directories; 1.2 将目录的操作权限赋值给指定的用户(不执行次步骤可能会出现权限问题): grant read,wr ...