您的位置:首页 > 其它

1092. To Buy or Not to Buy (20)

2017-02-23 14:05 323 查看
假题

#include<iostream>
#include<string>
using namespace std;
int main()
{
string str1, str2;
cin >> str1 >> str2;
int cnt = 0;
for (auto x : str2)
{
auto te = str1.find(x);
if (te < str1.size()) str1.erase(te, 1);//找到删掉主串的字符
else cnt++;//未找到,缺的+1
}
if (cnt != 0) cout << "No " << cnt << endl;
else cout << "Yes " << str1.size() << endl;
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  PAT-甲