func_code_string: #include <bits/stdc++.h>   using namespace std;   int solve(void) {     int n, s;     cin >> n >> s;     set<int> avail;     char c;     for (int i = 0; i < n; i++) {       cin >> c;       avail.insert((int)c -  a  + 1);     }     int cnt = 1;     int ans = *avail.begin();     int prev = ans;     avail.erase(avail.begin());     while (cnt < s) {       if (avail.empty()) return -1;       while (*avail.begin() < prev + 2) {         avail.erase(avail.begin());         if (avail.empty()) return -1;       }       prev = *avail.begin();       ans += prev;       avail.erase(avail.begin());       cnt++;     }     return ans;   }   int main(void) { cout << solve() << endl; }   