func_code_string: #include <bits/stdc++.h>   using namespace std;   map<int, int> m;   pair<bool, char> check(int a, string s) {     int flag = 0;     char x = s[a], e;     for (long long int i = 1 + (x -  a ); i < 26; i++) {       if (m.count(i)) {         return {true, char(i +  a )};       }     }     return {false,  f };   }   int main() {     ios_base ::sync_with_stdio(false), cin.tie(NULL), cout.tie(0);     int a, b;     cin >> a >> b;     string s;     cin >> s;     for (long long int i = 0; i < s.size(); i++) {       m[s[i] -  a ]++;     }     if (a < b) {       cout << s;       sort(s.begin(), s.end());       for (long long int i = 0; i < b - a; i++) cout << s[0];     } else {       int k = 0;       char e;       for (long long int i = b - 1; i >= 0; i--) {         pair<bool, char> p = check(i, s);         if (p.first) {           e = p.second;           k = i;           break;         }       }       for (long long int i = 0; i < k; i++) cout << s[i];       cout << e;       sort(s.begin(), s.end());       if (b - k - 1 > 0) {         for (long long int i = 0; i < b - k - 1; i++) cout << s[0];       }     }     return 0;   }   