func_code_string: #include <bits/stdc++.h>   using namespace std;   int main() {     long long int t;     cin >> t;     while (t--) {       long long int n, k;       cin >> n >> k;       string s, s1;       cin >> s;       long long int a[27] = {0}, c = 0, d = 0;       for (long long int i = 0; i < n; i++) {         if (a[s[i] -  a ] == 0) d++;         a[s[i] -  a ]++;       }       s1 = s;       sort(s1.begin(), s1.end());       if (k == 1)         cout << s1 << endl;       else {         long long int c1 = 0, c2 = 0;         for (long long int i = 0; i < n; i++) {           if (s1[i] == s1[0])             c1++;           else             break;         }         if (c1 < k) {           cout << s1[k - 1] << endl;         } else if (c1 == k) {           if (d == 1)             cout << s1[0] << endl;           else if (d == 2) {             long long int c2 = n - c1;             if (c2 % k == 0)               c2 = c2 / k;             else               c2 = (c2 / k) + 1;             cout << s1[0] <<   ;             for (long long int i = 0; i < c2; i++) cout << s1[c1] <<   ;             cout << endl;           } else {             cout << s1[0] <<   ;             for (long long int i = c1; i < n; i++) {               cout << s1[i] <<   ;             }             cout << endl;           }         } else {           if (d == 1) {             cout << s1[0] <<   ;             long long int c2 = c1 - k;             if (c2 % k == 0)               c2 = c2 / k;             else               c2 = (c2 / k) + 1;             for (long long int i = 0; i < c2; i++) cout << s1[0] <<   ;             cout << endl;           } else {             for (long long int i = k - 1; i < n; i++) cout << s1[i] <<   ;             cout << endl;           }         }       }     }   }   