func_code_string: #include <bits/stdc++.h>   using namespace std;   int main() {     int n, m;     cin >> n >> m;     int p[n];     for (int i = 0; i < n; i++) cin >> p[i];     sort(p, p + n);     map<string, int> mm;     string x;     for (int i = 0; i < m; ++i) {       cin >> x;       if (mm.find(x) == mm.end())         mm.insert(make_pair(x, 1));       else         mm[x]++;     }     vector<int> v;     for (auto i = mm.begin(); i != mm.end(); i++) {       v.push_back(i->second);     }     sort(v.begin(), v.end());     reverse(v.begin(), v.end());     long long int sum = 0;     for (int i = 0; i < v.size(); i++) {       sum += v[i] * p[i];     }     cout << sum <<    ;     sum = 0;     for (int i = 0; i < v.size(); i++) {       sum += v[i] * p[n - 1 - i];     }     cout << sum << endl;     return 0;   }   