一开始以为A-Z之后就是a-z。
#include <stdio.h>
#include <string.h>
int main()
{
char wanted[1001], shop[1001];
int need[62],i,flag=0;
scanf("%s %s", shop, wanted);
for (i = 0; i < 62; i++)
need[i] = 0;
for (i = 0; wanted[i] != '\0'; i++) {
if (wanted[i] >= '0' && wanted[i] <= '9')
need[wanted[i] - '0']++;
else if (wanted[i] >= 'A'&&wanted[i] <= 'Z')
need[wanted[i] - 'A' + 10]++;
else need[wanted[i] - 'a' + 36]++;
}
for (i = 0; shop[i] != '\0'; i++) {
if (shop[i] >= '0' && shop[i] <= '9')
need[shop[i] - '0']--;
else if (shop[i] >= 'A'&&shop[i] <= 'Z')
need[shop[i] - 'A' + 10]--;
else need[shop[i] - 'a' + 36]--;
}
for (i = 0; i < 62; i++)
if (need[i]>0) {
flag = 1;
break;
}
if (!flag)
printf("Yes %d",strlen(shop)-strlen(wanted));
else {
int missing=0;
while(i<62){
if (need[i]>0)
missing += need[i];
i++;
}
printf("No %d",missing);
}
return 0;
}