func_code_string: #include <bits/stdc++.h>   using namespace std;   const double Pi = acos(-1.0);   const double Eps = 1e-6;   const int Mod = (int)1e9 + 7;   long long Bigmod(long long b, long long p, long long m) {     if (p == 0) return 1LL;     if (p % 2 == 0) {       long long c = Bigmod(b, p / 2, m);       return ((c % m) * (c % m)) % m;     } else       return ((b % m) * (Bigmod(b, p - 1, m))) % m;   }   long long ModInverse(long long a, long long M) { return Bigmod(a, M - 2, M); }   template <class T>   inline T GCD(T x, T y) {     if (y == 0) return x;     return GCD(y, x % y);   }   template <class T>   inline T LCM(T x, T y) {     return ((x / GCD(x, y)) * y);   }   bool Reverse(long long a, long long b) { return a > b; }   bool Compare(pair<long long, long long> a, pair<long long, long long> b) {     if (a.first == b.first) return a.second > b.second;     return a.first < b.first;   }   int main() {     ios::sync_with_stdio(0);     cin.tie(0);     cout.tie(0);     int T;     cin >> T;     while (T--) {       string A, B;       cin >> A >> B;       if (A < B)         cout << A << endl;       else {         int Pos[27];         for (int i = 0; i < 27; i++) Pos[i] = -1;         for (int i = 0; i < A.size(); i++) {           int Position = A[i] -  A  + 1;           Pos[Position] = max(Pos[Position], i);         }         bool PreBreak = false, SolutionFound = false;         for (int i = 1; i <= 26; i++) {           if (Pos[i] == -1) continue;           for (int j = 0; j < Pos[i]; j++) {             if (A[j] > A[Pos[i]]) {               string Temp = A;               swap(Temp[j], Temp[Pos[i]]);               if (Temp < B) {                 cout << Temp << endl;                 SolutionFound = true;                 PreBreak = true;                 break;               }             }           }           if (PreBreak) break;         }         if (SolutionFound == false) cout <<  ---  << endl;       }     }     return 0;   }   