Skip to content

Commit 5582e96

Browse files
committed
feat: update 1092
1 parent f067ab8 commit 5582e96

File tree

2 files changed

+33
-4
lines changed

2 files changed

+33
-4
lines changed

PAT/.idea/workspace.xml

Lines changed: 2 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

PAT/1092/main.cpp

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
#include <iostream>
2+
#include <string>
3+
#include <map>
4+
using namespace std;
5+
6+
int main() {
7+
string a, b;
8+
cin >> a >> b;
9+
map<char, int> mp1, mp2;
10+
for (int i = 0; i < a.length(); i++) {
11+
mp1[a[i]]++;
12+
}
13+
for (int i = 0; i < b.length(); i++) {
14+
mp2[b[i]]++;
15+
}
16+
int miss = 0;
17+
map<char, int>::iterator it;
18+
for (it = mp2.begin(); it != mp2.end(); it++) {
19+
int sub = it->second - mp1[it->first];
20+
if (sub > 0) {
21+
miss += sub;
22+
}
23+
}
24+
if (miss != 0) {
25+
cout << "No " << miss << endl;
26+
}
27+
else {
28+
cout << "Yes " << a.length() - b.length() << endl;
29+
}
30+
return 0;
31+
}

0 commit comments

Comments
 (0)