| ||||||||||
| 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 | |||||||||
怎么就WA了?#include <iostream>
#include <string>
using namespace std;
int main()
{
int n;
cin>>n;
string s1,s2;
char ch[255];
for(int i=0;i<n;i++){
fflush(stdin);
cin.getline(ch,255);
s1=ch;
cin.getline(ch,255);
s2=ch;
int d=0;
string::iterator it2=s2.begin();
for(int j=0;j<s1.length();j++){
for(int k=0;k<s2.length();k++){
if(s1[j]==s2[k]){
s2.erase(it2+k);
d++;
break;
}
}
}
cout<<"Case #"<<i+1<<": "<<s1.length()+s2.length()-d<<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