func_code_string: #include <bits/stdc++.h>   using namespace std;   int cmp(int a, int b) { return a > b; }   int main() {     int i, j, m, n, sm = 0, sn = 0, num[110], e[110];     string s;     map<string, int> mapp;     map<string, int>::iterator it;     scanf( %d%d , &m, &n);     for (i = 0; i < m; i++) {       scanf( %d , &num[i]);     }     sort(num, num + m, cmp);     for (i = 0; i < n; i++) {       cin >> s;       for (it = mapp.begin(); it != mapp.end(); it++) {         if (it->first == s) {           it->second++;           break;         }       }       if (it == mapp.end()) mapp.insert(pair<string, int>(s, 1));     }     for (it = mapp.begin(), i = 0; it != mapp.end(); ++it, i++) {       e[i] = it->second;     }     sort(e, e + i, cmp);     n = i;     for (i = 0; i < n; i++) {       sm += e[i] * num[i];       sn += e[i] * num[m - i - 1];     }     printf( %d %d , sn, sm);   }   