简单题
View Code
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
using namespace std;
#define maxl 50
char w1[maxl], w2[maxl];
int f1[26], f2[26];
void work(char *w, int *f)
{
int len = strlen(w);
for (int i = 0; i < len; i++)
f[w[i] - 'a']++;
}
int main()
{
//freopen("t.txt", "r", stdin);
int n, t = 0;
scanf("%d", &n);
getchar();
while (n--)
{
memset(f1, 0, sizeof(f1));
memset(f2, 0, sizeof(f2));
gets(w1);
gets(w2);
work(w1, f1);
work(w2, f2);
int ans = 0;
for (int i = 0; i < 26; i++)
ans += abs(f1[i] - f2[i]);
printf("Case #%d: %d \n", ++t, ans);
}
return 0;
}