#include<cstdio>
#include<cstring>
int change(char ch){
if(ch >= '0' && ch <= '9') return ch - '0';
if(ch >= 'a' && ch <= 'z') return ch - 'a' + 10;
if(ch >= 'A' && ch <= 'Z') return ch - 'A' + 36;
}
int main(){
char whole[1001], target[1001];
int HashTable[80] = {0}, miss = 0;
scanf("%s", whole);
scanf("%s", target);
int len1 = strlen(whole);
int len2 = strlen(target);
for(int i = 0; i < len1; i++){
int id = change(whole[i]);
HashTable[id]++;
}
for(int j = 0; j < len2; j++){
int id = change(target[j]);
HashTable[id]--;
if(HashTable[id] < 0){
miss++;
}
}
if(miss > 0) printf("No %d\n", miss);
else printf("Yes %d\n", len1-len2);
return 0;
}
原文地址:https://www.cnblogs.com/zjsaipplp/p/10425243.html
时间: 2024-10-09 01:06:37