#include <bits/stdc++.h>
using namespace std;
// Complete the makeAnagram function below.
int makeAnagram(string a, string b) {
vector<int> count(26, 0);
int c=0;
for(auto i: a) ++count[i-'a'];
for(auto i: b) --count[i-'a'];
for(auto i: count) c += abs(i);
return c;
}
int main()
{
ofstream fout(getenv("OUTPUT_PATH"));
string a;
getline(cin, a);
string b;
getline(cin, b);
int res = makeAnagram(a, b);
fout << res << "\n";
fout.close();
return 0;
}
[백준(BOJ)] 5585번: 거스름돈 (그리디(Greedy) 알고리즘, C++) (0) | 2021.01.20 |
---|---|
[HackerRank] Alternating Characters (String Manipulation) (C++, Python) (0) | 2021.01.17 |
[HackerRank] Mark and Toys (sorting) (python, C++) (0) | 2021.01.16 |
[HackerRank] Sorting: Bubble Sort (Sorting) (0) | 2021.01.16 |
[HackerRank] Two Strings (python) (0) | 2021.01.14 |