func_code_string: #include <bits/stdc++.h>   using namespace std;   const int MAX = 60;   const int A = 26;   const int INF = 1000000001;   char G[MAX + 2][MAX + 3];   int D[MAX + 2][MAX + 2];   bool ok[A + 1];   pair<int, int> S, T;   vector<char> ans;   vector<int> K;   int n, m, k;   inline int con(char c) { return  a  <= c && c <=  z  ? c -  a  : A; }   vector<pair<int, int> > Q;   int dx[] = {1, -1, 0, 0};   int dy[] = {0, 0, 1, -1};   bool vis[A + 1][A + 1][A + 1][A + 1];   void bfs() {     sort((K).begin(), (K).end());     K.erase(unique((K).begin(), (K).end()), K.end());     if (K.back() == A) K.pop_back();     if (K.size() > k || K.empty()) return;     if (vis[K[0]][K.size() > 1 ? K[1] : A][K.size() > 2 ? K[2] : A]            [K.size() > 3 ? K[3] : A])       return;     vis[K[0]][K.size() > 1 ? K[1] : A][K.size() > 2 ? K[2] : A]        [K.size() > 3 ? K[3] : A] = true;     for (int i = 0; i < K.size(); ++i) ok[K[i]] = true;     for (int i = 0; i <= n + 1; ++i) memset(D[i], -1, sizeof(int) * (m + 2));     Q.clear();     Q.push_back(T);     D[T.first][T.second] = 0;     for (int foo = 0; foo < Q.size(); ++foo) {       pair<int, int> v = Q[foo];       if (v == S) break;       for (int foo = 0; foo < 4; ++foo) {         int i = v.first + dx[foo];         int j = v.second + dy[foo];         if (ok[con(G[i][j])] && D[i][j] == -1) {           D[i][j] = D[v.first][v.second] + 1;           Q.push_back(make_pair(i, j));         }       }     }     for (int i = 0; i < K.size(); ++i) ok[K[i]] = false;     int d = INF;     for (int foo = 0; foo < 4; ++foo) {       int i = S.first + dx[foo];       int j = S.second + dy[foo];       if (D[i][j] != -1) d = min(d, D[i][j]);     }     if (d > ans.size()) return;     int com = 0;     int index = 0;     vector<char> tmp;     tmp.reserve(d);     vector<pair<int, int> > V[2];     bool now = false;     V[0].push_back(S);     while (d) {       int best = 200;       for (int i = 0; i < K.size(); ++i)         for (__typeof((V[now]).begin()) u = (V[now]).begin(); u != (V[now]).end();              ++u)           for (int foo = 0; foo < 4; ++foo) {             int x = u->first + dx[foo];             int y = u->second + dy[foo];             if (G[x][y] == K[i] +  a  && D[x][y] == d) {               best = K[i];               goto out;             }           }     out:       tmp.push_back(best +  a );       if (!com) {         if (tmp.back() < ans[index])           com = -1;         else if (tmp.back() > ans[index])           com = 1;       }       ++index;       V[!now].clear();       for (__typeof((V[now]).begin()) u = (V[now]).begin(); u != (V[now]).end();            ++u)         for (int foo = 0; foo < 4; ++foo) {           int x = u->first + dx[foo];           int y = u->second + dy[foo];           if (G[x][y] == best +  a  && D[x][y] == d) {             V[!now].push_back(make_pair(x, y));             D[x][y] = -1;           }         }       --d;       now = !now;     }     if (tmp.size() < ans.size() || com == -1) ans = tmp;   }   void solve(int x, int i) {     if (x >= k) {       vector<int> tmpK = K;       bfs();       K = tmpK;       return;     }     if (i == A) return;     solve(x, i + 1);     for (; i < A; ++i) {       K.push_back(i);       solve(x + 1, i + 1);       K.pop_back();     }   }   int main(int argc, char *argv[]) {     scanf( %d %d %d , &n, &m, &k);     ans.resize(n * m + 10);     for (int i = 0; i <= n + 1; ++i) memset(G[i],  $ , m + 2);     for (int i = 1; i <= n; ++i) scanf( %s , G[i] + 1);     for (int i = 1; i <= n; ++i)       for (int j = 1; j <= m; ++j)         if (G[i][j] ==  S )           S = make_pair(i, j);         else if (G[i][j] ==  T )           T = make_pair(i, j);     if (abs(S.first - T.first) + abs(S.second - T.second) == 1) return 0;     for (int xs = S.first - 1; xs <= S.first + 1; ++xs)       for (int ys = S.second - 1; ys <= S.second + 1; ++ys)         if (abs(xs - S.first) + abs(ys - S.second) == 1)           for (int xt = T.first - 1; xt <= T.first + 1; ++xt)             for (int yt = T.second - 1; yt <= T.second + 1; ++yt)               if (abs(xt - T.first) + abs(yt - T.second) == 1) {                 K.clear();                 K.push_back(con(G[xs][ys]));                 K.push_back(con(G[xt][yt]));                 if (K[0] == K[1]) K.pop_back();                 solve(K.size(), 0);               }     if (ans.size() == n * m + 10) {       printf( -1 n );       return 0;     }     for (__typeof((ans).begin()) i = (ans).begin(); i != (ans).end(); ++i)       printf( %c , *i);     printf(  n );     return 0;   }   