D

题目链接:https://vjudge.net/contest/168648#problem/D

题目大意:在所给的字符串中截取codeforces的子串(只能取一次!)

题解:因为数据比较水,这里运用到了string头文件中的substr函数来解决这个问题

code:

#include <cstdio>
#include <iostream>
#include <string>

using namespace std;

int main()
{
 string str,str1,str2;
 cin>>str;
 for(int i=0;i<str.size();i++)
 {
  for(int j=i+1;j<str.size();j++)
  {
   str1=str.substr(0,i)+str.substr(j);
   if(str1=="CODEFORCES")
   {
    printf("YES ");
    return 0;
   }
  }
 }
 printf("NO ");
 return 0;
}

原文地址:https://www.cnblogs.com/DemonZiv/p/7105371.html