time limit per test

2 seconds

memory limit per test

256 megabytes

input

standard input

output

standard output

A large banner with word CODEFORCES was ordered for the 1000-th onsite round of Codeforcesω that takes place on the Miami beach. Unfortunately, the company that made the banner mixed up two orders and delivered somebody else's banner that contains someone else's word. The word on the banner consists only of upper-case English letters.

There is very little time to correct the mistake. All that we can manage to do is to cut out some substring from the banner, i.e. several consecutive letters. After that all the resulting parts of the banner will be glued into a single piece (if the beginning or the end of the original banner was cut out, only one part remains); it is not allowed change the relative order of parts of the banner (i.e. after a substring is cut, several first and last letters are left, it is allowed only to glue the last letters to the right of the first letters). Thus, for example, for example, you can cut a substring out from string 'TEMPLATE' and get string 'TEMPLE' (if you cut out string AT), 'PLATE' (if you cut out TEM), 'T' (if you cut out EMPLATE), etc.

Help the organizers of the round determine whether it is possible to cut out of the banner some substring in such a way that the remaining parts formed word CODEFORCES.

Input

The single line of the input contains the word written on the banner. The word only consists of upper-case English letters. The word is non-empty and its length doesn't exceed 100 characters. It is guaranteed that the word isn't word CODEFORCES.

Output

Print 'YES', if there exists a way to cut out the substring, and 'NO' otherwise (without the quotes).

Examples
Input
CODEWAITFORITFORCES
Output
YES
Input
BOTTOMCODER
Output
NO
Input
DECODEFORCES
Output
YES
Input
DOGEFORCES
Output
NO

题意就是条幅打错字母了,让你随便剪一次,剪去多余的字母,问你剩下的能否接成CODEFORCES的字样,要注意的是接的时候不可以改变顺序,只能剪一次!!!wa在没看清题意是剪一次。。。

一个很6的函数,直接就可以了。。。

substr函数用法举例:

substr('ABCDEFG', 0);     //返回:ABCDEFG,截取所有字符
substr('ABCDEFG', 2);     //返回:CDEFG,截取从C开始之后所有字符
substr('ABCDEFG', 0, 3); //返回:ABC,截取从A开始3个字符
substr('ABCDEFG', 0, 100); //返回:ABCDEFG,100虽然超出预处理的字符串最长度,但不会影响返回结果,系统按预处理字符串最大数量返回。
substr('ABCDEFG', -3); //返回:EFG,注意参数-3,为负值时表示从尾部开始算起,字符串排列位置不变

代码:

#include<bits/stdc++.h>
using namespace std;
int main(){
string str,str1;
int i,j;
cin>>str;
for(i=;i<str.size();i++){
for(j=i+;j<=str.size();j++){
str1=str.substr(,i)+str.substr(j);
if(str1=="CODEFORCES"){
printf("YES\n");
return ;
}
}
}
printf("NO\n");
return ;
}
 

Codeforces Round #300(Div. 2)-538A.str.substr 538B.不会 538C.不会 。。。的更多相关文章

  1. Codeforces Round #539 (Div. 2) - D. Sasha and One More Name(思维)

    Problem   Codeforces Round #539 (Div. 2) - D. Sasha and One More Name Time Limit: 1000 mSec Problem ...

  2. Codeforces Round #233 (Div. 2) B. Red and Blue Balls

    #include <iostream> #include <string> using namespace std; int main(){ int n; cin >&g ...

  3. Codeforces Round #367 (Div. 2) C. Hard problem(DP)

    Hard problem 题目链接: http://codeforces.com/contest/706/problem/C Description Vasiliy is fond of solvin ...

  4. Codeforces Round #368 (Div. 2) A. Brain's Photos (水题)

    Brain's Photos 题目链接: http://codeforces.com/contest/707/problem/A Description Small, but very brave, ...

  5. Codeforces Round #277 (Div. 2) 题解

    Codeforces Round #277 (Div. 2) A. Calculating Function time limit per test 1 second memory limit per ...

  6. Codeforces Round #403 (Div. 2, based on Technocup 2017 Finals)

    Codeforces Round #403 (Div. 2, based on Technocup 2017 Finals) 说一点东西: 昨天晚上$9:05$开始太不好了,我在学校学校$9:40$放 ...

  7. Codeforces Round #491 (Div. 2)

    Codeforces Round #491 (Div. 2) https://codeforces.com/contest/991 A #include<bits/stdc++.h> us ...

  8. Codeforces Round #497 (Div. 2)

    Codeforces Round #497 (Div. 2) https://codeforces.com/contest/1008 A #include<bits/stdc++.h> u ...

  9. Codeforces Round #499 (Div. 2)

    Codeforces Round #499 (Div. 2) https://codeforces.com/contest/1011 A #include <bits/stdc++.h> ...

随机推荐

  1. nginx取结构体地址

    linux内核提供了一个container_of()宏,可以根据结构体某个成员的地址找到父结构的地址. #define container_of(ptr, type, member) ({ \ con ...

  2. web调用客户端程序

    背景 最近做一个集成需求,我们是B/S架构的,对方是C/S架构的,对方直接扔过来一个EXE连OCX都没有,让我们调用,也就是说,我们需要通过js程序去调用他们的客户端程序并传入多个参数,当时内心是崩溃 ...

  3. awk 命令详解

    作用:awk 是一种编程语言, 用于在linux/unix 下对文本和数据进行处理. 数据可以来自标准输入(stdin),一个或多个文件, 或其他命令的输出.它支持用户自定义函数和动态正则表达式等先进 ...

  4. java-FFmpeg(一) 实现视频的转码和截图功能

    FFmpeg是一个开源免费跨平台的视频和音频流方案,属于自由软件,采用LGPL或GPL许可证(依据你选择的组件).它提供了录制.转换以及流化音视频的完整解决方案.它包含了非常先进的音频/视频编解码库l ...

  5. Xamarin.Android 引导页

    http://blog.csdn.net/qq1326702940/article/details/78665588 https://www.cnblogs.com/catcher1994/p/555 ...

  6. Java核心技术(Java白皮书)卷Ⅰ 第一章 Java程序设计概述

    第1章 Java程序设计概述1.1 Java程序设计平台 具有令人赏心悦目的语法和易于理解的语言,与其他许多优秀语言一样,Java满足这些要求. 可移植性 垃圾收集 提供大型的库  如果想要有奇特的绘 ...

  7. 转:java 可设置最大内存

    测试方法:在命令行下用 java -XmxXXXXM -version ,比如:java -Xmx1024M -version命令来进行测试,然后逐渐的增大XXXX的值,如果执行正常就表示指定的内存大 ...

  8. [C#]如何访问及调用类中私有成员及方法

    本文为原创文章.源代码为原创代码,如转载/复制,请在网页/代码处明显位置标明原文名称.作者及网址,谢谢! 开发工具:VS2017 语言:C# DotNet版本:.Net FrameWork 4.0及以 ...

  9. 简易排水简车的制作 TurnipBit 系列教程

    准备工作   ü TurnipBit 开发板 1块 ü 下载数据线 1条 ü 微型步进电机(28BYJ-48) 1个 ü 步进电机驱动板(ULN2003APG) 1块 ü TurnipBit 扩展板 ...

  10. webapi框架搭建-日志管理log4net

    前言 本篇讲怎么在前几篇已经创建好的项目里加上日志处理机制,我们采用Log4net技术.跟多的log4net技术的细节请查阅log4net的官网. log4net官网:http://logging.a ...