| ||||||||||
| 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 | |||||||||
求测试数据,求大神指出错误#include<iostream>
#include<string.h>
using namespace std;
int main()
{
string str1,str2;
int i,j,len1,len2,count1,count2,point;
while(cin>>str1>>str2)
{
len1=str1.size();
len2=str2.size();
i=0;count1=0;j=0;point=0;
while(i<len1)
{
while(j<len2)
{
if(str1[i]!=str2[j])
j++;
else
{
count1++;
point=j+1;
break;
}
}
j=point;
i++;
}
i=0;count2=0;j=0;point=0;
while(j<len2)
{
while(i<len1)
{
if(str1[i]!=str2[j])
i++;
else
{
count2++;
point=i+1;
break;
}
}
i=point;
j++;
}
if(count1>count2)
cout<<count1<<endl;
else
cout<<count2<<endl;
}
}
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator