func_code_string: #include <bits/stdc++.h>   using namespace std;   long long dr[] = {-1, 1, 0, 0, -1, 1, -1, 1};   long long dc[] = {0, 0, -1, 1, -1, -1, 1, 1};   int main() {     long long T;     cin >> T;     while (T--) {       string a, b;       cin >> a >> b;       if (a < b) {         cout << a <<   n ;         continue;       }       bool f = 0;       long long sz = min(a.size(), b.size());       long long loop = 0;       for (long long i = 0; i < sz; i++) {         if (a[i] < b[i]) {           f = 1;           break;         } else {           long long indx = -1;           char mn = b[i];           for (long long j = i + 1; j < a.size(); j++) {             if (a[j] <= mn) {               mn = a[j];               indx = j;             }           }           if (indx == -1 and a[i] > b[i]) {             break;           } else if (indx == -1 and a[i] == b[i]) {             continue;           }           if (a[i] == a[indx]) continue;           swap(a[i], a[indx]);           loop++;           if (a < b) {             f = 1;           }           break;         }       }       if (f == 1) {         cout << a <<   n ;       } else {         cout <<  ---               <<   n ;       }     }     return 0;   }   