func_code_string: #include <bits/stdc++.h>   using namespace std;   inline bool EQ(double a, double b) { return fabs(a - b) < 1e-9; }   const int INF = (((1 << 30) - 1) << 1) + 1;   const int nINF = 1 << 31;   string s;   vector<int> v[2], ans;   int n, t;   void print(vector<int>& vec) {     for (int x : vec) cout << x <<    ;     cout << endl;   }   signed main() {     ios::sync_with_stdio(false);     cin >> t;     while (t--) {       v[0].clear(), v[1].clear(), ans.clear();       cin >> n >> s;       bool good = true, two = false;       int lo = 10;       for (int i = 0; i < (n); i++) {         if (two) {           if (s[i] == lo && s[v[1].back()] == lo) {             v[1].push_back(i);           } else if (s[i] <= lo) {             if (!v[0].empty() && s[i] < s[v[0].back()]) {               good = false;               break;             } else {               v[0].push_back(i);             }           } else {             if (!v[1].empty() && s[i] < s[v[1].back()]) {               good = false;               break;             } else {               v[1].push_back(i);             }           }         } else {           if (!v[0].empty() && s[i] < s[v[0].back()]) {             two = true;             vector<int> temp;             while (!v[0].empty() && s[i] < s[v[0].back()]) {               temp.push_back(v[0].back());               v[0].pop_back();             }             lo = s[temp.back()];             while (!temp.empty()) {               v[1].push_back(temp.back());               temp.pop_back();             }           }           v[0].push_back(i);         }       }       ans.resize(n, 1);       for (int i = 0; i < (v[1].size()); i++) {         ans[v[1][i]] = 2;       }       if (!good)         cout <<  -  << endl;       else {         for (int x : ans) cout << x;         cout << endl;       }     }     return 0;   }   