| ||||||||||
| Online Judge | Problem Set | Authors | Online Contests | User | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest | |||||||||
我用string做的不知道厚道不厚道In Reply To:Re:哪位过的大神把代码贴出来瞧瞧。。。 Posted by:ctzsm at 2010-01-17 22:00:40 #include <cstdio>
#include <iostream>
#include <string>
using namespace std;
//3753
int main(void)
{
string strSource,strTemp;
while(cin>>strSource)
{
while(cin>>strTemp)
{
if(strTemp == "END")
break;
int index = strSource.find(strTemp);
if(strTemp == "NULL")
cout<<0<<" "<<"NULL"<<endl;
else if(index == string::npos)
cout<<strSource.length()<<" "<<strSource<<endl;
else if(index == 0)
cout<<0<<" "<<"NULL"<<endl;
else
cout<<index<<" "<<strSource.substr(0,index)<<endl;
}
}
return 0;
}
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator