func_code_string: #include <bits/stdc++.h>   using namespace std;   const int MAXN = 55, dx[4] = {0, 0, -1, 1}, dy[4] = {1, -1, 0, 0};   int n, m, k, dis[MAXN][MAXN], sx, sy, tx, ty;   queue<pair<int, int> > S;   char mp[MAXN][MAXN];   string ans, res;   bool r[27], o;   bool isval(int x, int y) { return x < n && y < m && x >= 0 && y >= 0; }   void BFS(vector<pair<int, int> > w) {     vector<pair<int, int> > rx[27];     for (int ii = 0; ii < w.size(); ii++) {       int x = w[ii].first, y = w[ii].second;       for (int i = 0; i < 4; i++) {         int nx = x + dx[i], ny = y + dy[i];         if (!isval(nx, ny) || (!r[mp[nx][ny] -  a ] && mp[nx][ny] !=  T ) ||             dis[nx][ny] + 1 != dis[x][y])           continue;         if (mp[nx][ny] ==  T ) return;         rx[mp[nx][ny] -  a ].push_back({nx, ny});       }     }     for (int i = 0; i < 27; i++) {       sort(rx[i].begin(), rx[i].end());       rx[i].resize(unique(rx[i].begin(), rx[i].end()) - rx[i].begin());       if (rx[i].size() == 0) continue;       BFS(rx[i]);       res += (char)( a  + i);       return;     }   }   void solve() {     res.clear();     for (int i = 0; i < n; i++)       for (int j = 0; j < m; j++) dis[i][j] = -1;     S.push({tx, ty});     dis[tx][ty] = 0;     while (!S.empty()) {       pair<int, int> c = S.front();       S.pop();       for (int i = 0; i < 4; i++) {         int nx = c.first + dx[i], ny = c.second + dy[i];         if (!isval(nx, ny) ||             (mp[nx][ny] !=  S  && mp[nx][ny] !=  T  && !r[mp[nx][ny] -  a ]))           continue;         if (dis[nx][ny] == -1) {           S.push({nx, ny});           dis[nx][ny] = dis[c.first][c.second] + 1;         }       }     }     if (dis[sx][sy] == -1) return;     vector<pair<int, int> > vc;     vc.push_back({sx, sy});     BFS(vc);     reverse(res.begin(), res.end());     if (!o)       ans = res, o = 1;     else {       if (ans.size() < res.size()) return;       if (ans.size() > res.size())         ans = res;       else         ans = min(ans, res);     }   }   void bt(int ind, int rem) {     if (ind == 26) {       solve();       return;     }     if (rem > 0) {       r[ind] = 1;       bt(ind + 1, rem - 1);     }     r[ind] = 0;     bt(ind + 1, rem);   }   int main() {     cin >> n >> m >> k;     for (int i = 0; i < n; i++)       for (int j = 0; j < m; j++) {         cin >> mp[i][j];         if (mp[i][j] ==  S )           sx = i, sy = j;         else if (mp[i][j] ==  T )           tx = i, ty = j;       }     bt(0, k);     if (!o)       cout << -1 << endl;     else       cout << ans << endl;   }   