poj 3753 根据关键字进行字符串拷贝

#include<iostream>
#include
<string>
using namespace std;
int main()
{
string str1,str2;
while(cin>>str1)
{
while(cin>>str2&&str2!="END")
{
if(str2=="NULL")
{
printf(
"0 NULL\n");continue;
}
int id=str1.find(str2);
if(id==0)
{
printf(
"0 NULL\n");
}
else if(id==-1)
cout
<<str1.size()<<" "<<str1<<endl;
else
{
cout
<<id<<" ";
for(int i=0;i<id;++i)
cout
<<str1[i];
cout
<<endl;
}
}
}
return 0;
}

  

posted on 2011-07-22 20:43  sysu_mjc  阅读(155)  评论(0编辑  收藏  举报

导航