题目描述

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. swift 学习- 14 -- 继承

    // 一个类可以继承另一个 类的方法, 属性和其他特征, 当一个类继承其他类时, 继承类叫子类, 被继承类叫父类 或 (超类), 在 Swift 中, 继承是区分 [类] 和其他类型的 一个基本特征 ...

  2. PID控制器开发笔记之六:不完全微分PID控制器的实现

    从PID控制的基本原理我们知道,微分信号的引入可改善系统的动态特性,但也存在一个问题,那就是容易引进高频干扰,在偏差扰动突变时尤其显出微分项的不足.为了解决这个问题人们引入低通滤波方式来解决这一问题. ...

  3. Windows服务启动进程----Cjwdev.WindowsApi.dll

    windows服务下无法启动外部程序 做一个windows服务监听服务,涉及到windows服务启动外部程序的一个过程,但是调试测试发现,无法简单的用process.start()这种方法, 原因是在 ...

  4. python用unittest+HTMLTestRunner的框架测试并生成测试报告

    直接贴代码: import unittestfrom selenium import webdriverfrom time import sleepimport osimport time # 定义打 ...

  5. poj2817状态压缩 升维

    /* 两两求出字符串之间最大可以匹配的值 由已知状态推导出位置状态 状态s表示已经加入到集合中的字符串,0表示串i不存在,1存在 由于字符串的加入顺序会影响结果,所以增加一维来表示 dp[S][i]表 ...

  6. Windows文件系统

    微软在Dos/Windows系列操作系统中共使用了6种不同的文件系统(包括即将在windows的下一个版本中使用的Winfs).它们分别是:FAt12.FAT16.FAT32.NTFS.NTFS5.0 ...

  7. GAN-生成对抗网络原理

    最近一直在看GAN,我一直认为只有把博客看了一遍,然后再敲一遍.这样才会有深刻的感悟. GAN(生成式对抗网络)(GAN, Generative Adversarial Networks )是一种深度 ...

  8. DDD工作流持久化(十六)

    找到对应的sql文件执行sql语句 产生如下的表: 添加引用: 添加命名空间: using System.Activities.DurableInstancing; using System.Runt ...

  9. 删除TFS中的项目

    打开“Team Foundation Server 管理控制台”,选择应用层->团队项目集合->团队项目->点击项目集合名称,最后点击右侧出现的删除按钮

  10. python---使用递归实现谢尔宾斯基三角形及汉诺塔

    渐入佳境. # coding: utf-8 import turtle ''' # =================turtle练手== def draw_spiral(my_turtle, lin ...