题目描述

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. js——class基础

    js的类?其实还是原型! class Point{ constructor(x, y){ this.x = x; this.y = y; } toString(){ return '(' + this ...

  2. js——字符串处理

    字符串不能修改,所以修改后的结果都是以一个新的字符串返回,原串不改变 1. 创建字符串和typeof           - 空字符串 var str = ""; - " ...

  3. CSS弹性(flexible)盒子

    弹性盒子         弹性盒子由弹性容器(Flex container)和弹性子元素(Flex item)组成 弹性容器通过display:flex | inline-flex将其定义为弹性容器 ...

  4. Oracle12c安装和卸载图文教程

    注:本文来源于:<Oracle12c安装和卸载图文教程> 一.安装 1.去官网下载相应的版本 2.下载好的两个压缩文件压缩到一个文件夹中 3.打开上个步骤的文件夹,运行stepup,显示如 ...

  5. 使用open live writer客户端写博客

    注:Windows Live Writer 已经停止更新,建议安装 Open Live Writer,下载地址: http://openlivewriter.org/ 使用open live writ ...

  6. VUE开发请求本地数据的配置,旧版本dev-server.js,新版本webpack.dev.conf.js

    VUE开发请求本地数据的配置,早期的vue-lic下面有dev-server.js和dev-client.js两文件,请求本地数据在dev-server.js里配置,最新的vue-webpack-te ...

  7. JSP 动作

    动作是第三种类型的语法元素,它们被转换成Java 代码来执行操作,如访问一个Java对象或调用方法. 一. useBean useBean将创建一个关联Java对象的脚本变量.这 是早期分离的表示层和 ...

  8. 雅礼 noip2018 模拟赛day3 T2

    典型的状压思想 设0表示黑球,1表示白球,用一串01序列代表剩下的球的状态,记f[i]表示在i状态下取球的最大期望 那么可以利用记忆化搜索更新,每一层枚举可能拿走的球然后向下搜索,同时记忆化即可 在状 ...

  9. mac下Fiddler的安装-启动

    使用教程参考:http://www.cnblogs.com/TankXiao/archive/2012/02/06/2337728.html#request 环境安装 Mono安装 首先,Mac下需要 ...

  10. 流媒体服务器SRS部署

    github地址:https://github.com/ossrs/srs 1,srs下载 http://ossrs.net/srs.release/releases/index.html 选择正式发 ...