#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <algorithm>
#include <string>
#include <cstring>
using namespace std;
int book[1000]={0};
int main()
{
// freopen("in.txt","r",stdin);
int cou1=0,cou2=0;
char ch;
while( (ch=getchar())!='\n' )
{
cou1++;
int t=ch;
book[t]++;
}
int miss=0;
while( (ch=getchar())!=EOF )
{
if(ch=='\n')
break;//吸收掉最后一个回车
cou2++;
int t=ch;
book[t]--;
if(book[t]<0)
miss++;
}
if(miss==0)
printf("Yes %d",cou1-cou2);
else
printf("No %d",miss);
return 0;
}
1092. To Buy or Not to Buy (20)
最新推荐文章于 2025-09-24 00:11:20 发布
本文介绍了一个简单的C++程序,该程序用于统计输入字符的出现频率,并判断两段输入是否由相同的字符组成。通过使用数组来记录每个ASCII字符的出现次数,程序能够高效地完成字符频率的对比。

438

被折叠的 条评论
为什么被折叠?



