#include<cstdio>
#include<iostream>
#include<string>
using namespace std;
char hash1[128]={0};
char hash2[128]={0};
int main(){
string str1,str2;
getline(cin,str1);
getline(cin,str2);
int len1 = str1.length();
int len2 = str2.length();
for(int i=0;i<len1;i++){
char c = str1[i];
hash1[c] += 1;
}
for(int i=0;i<len2;i++){
char c = str2[i];
hash2[c] += 1;
}
int flag = 1;
int less = 0, more = 0;
for(int i=0;i<128;i++){
if(hash2[i] > hash1[i]){
flag = 0;
less = less + (hash2[i]-hash1[i]);
}
else if(hash2[i] <= hash1[i]){
more = more + (hash1[i]-hash2[i]);
}
}
if(flag == 1){
printf("Yes %d",more);
}
else printf("No %d",less);
}
PAT A1092 To Buy or Not to Buy
最新推荐文章于 2023-03-15 22:58:10 发布