func_code_string: #include <bits/stdc++.h>   using namespace std;   int main() {     long long int t;     t = 1;     while (t--) {       long long int n, m;       cin >> n >> m;       long long int arr[n];       string arr2[m];       for (long long int i = 0; i < n; i++) {         cin >> arr[i];       }       map<string, int> mp;       for (long long int i = 0; i < m; i++) {         cin >> arr2[i];         if (mp.find(arr2[i]) != mp.end()) {           std::map<string, int>::iterator it = mp.find(arr2[i]);           it->second++;         } else {           mp.insert({arr2[i], 1});         }       }       sort(arr, arr + n);       vector<long long int> freq;       for (auto &it : mp) {         freq.push_back(it.second);       }       sort(freq.begin(), freq.end(), greater<long long int>());       long long int ans = 0;       long long int ans2 = 0;       for (long long int i = 0; i < freq.size(); i++) {         ans += freq[i] * arr[i];         ans2 += freq[i] * arr[n - i - 1];       }       cout << ans <<     << ans2 << endl;     }   }   