http://poj.org/problem?id=2681
给你任意长度的字符串,找出两串字符中不相同的字符个数(总数)
#include<string> #include#include #include using namespace std; int main() {int n;scanf("%d ",&n);string aa,bb;int q=0;for(int i=1;i<=n;i++){int sum=0;int a1[51]={ 0},b1[51]={ 0};getline(cin,aa);getline(cin,bb);//scanf("%s %s",aa,bb);int a=aa.length();int b=bb.length();if(a==0||b==0){cout<<"Case #"<": "< endl;}//int sum=0;else{for(int k=0;k){for(int j=0;j){if(aa[k]==bb[j]&&a1[k]==0&&b1[j]==0){a1[k]=1;b1[j]=1;}}}for(int k=0;k){if(a1[k]==0)sum++;}for(int j=0;j){if(b1[j]==0)sum++;}cout<<"Case #"<": "< endl;}}return 0; }