cf 8a Train and Peter
2015-10-25 01:07
399 查看
#include <iostream> #include <cstdio> #include <algorithm> using namespace std; int main() { string s,s1,s2; bool f1=false,f2=false; cin>>s>>s1>>s2; int a,b; a=s.find(s1); if(a!=std::string::npos) { b=s.find(s2,a+s1.length()); if(b!=std::string::npos) f1=true; } string ss=""; for(int i=s.length()-1;i>=0;i--) ss+=s[i]; a=ss.find(s1); if(a!=std::string::npos) { b=ss.find(s2,a+s1.length()); if(b!=std::string::npos) f2=true; } if(f1&&f2) printf("both\n"); else if(f1) printf("forward\n"); else if(f2) printf("backward\n"); else printf("fantasy\n"); return 0; }
相关文章推荐
- Daily Scrum 10.24
- Daily Scrum 10.23
- Daily Scrum 10.22
- Daily Scrum 10.21
- Daily Scrum 10.24
- 利用highchair画出简易版甘特图
- RESOURCE_SEMAPHORE Waittype
- coderforce 579A Raising Bacteria
- Windows server 2012 R2 DHCP failover配置
- 2015 Fall HIT Weekly Training 2
- Coursera_Stanford_ML_ex6_支持向量机(SVM) 作业记录
- regular polygon can be drawn only by straightedge and compass
- POJ-1995 Raising Modulo Numbers
- AI顶级会议以及期刊
- container_of()宏
- _pActualRawDllMain cannot be in a R/W section
- Daily Scrum (2015/10/23)
- 2015年10月18日-10月24日作业:mairadb, vsftp, nfs, samb
- 创建maven项目时报错:Failed to execute goal org.apache.maven.plugins:maven-archetype-plugin:2.4
- uva11029 - Leading and Trailing