Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <string>
- #include <map>
- #include <algorithm>
- using namespace std;
- void m(const string& a, map<char, int> &a1) {
- for (int i = 0; i < a.size(); ++i) {
- ++a1[a[i]];
- }
- }
- int main() {
- string a;
- getline(cin, a);
- string b;
- getline(cin, b);
- map<char, int> a1;
- map<char, int> b1;
- m(a, a1);
- m(b, b1);
- cout << "first string" << endl;
- for (auto it = a1.begin(); it != a1.end(); ++it) {
- cout << it->first << " : " << it->second << endl;
- }
- cout << "second string"<< endl;
- for (auto it = b1.begin(); it != b1.end(); ++it) {
- cout << it->first << " : " << it->second << endl;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement