func_code_string: #include <bits/stdc++.h>   using namespace std;   int main() {     int n, m;     scanf( %d %d , &n, &m);     vector<string> grid;     int start_x, start_y;     for (int i = 0; i < n; i++) {       string s;       cin >> s;       grid.push_back(s);       for (int j = 0; j < s.size(); j++) {         if (s[j] ==  S ) {           start_x = i;           start_y = j;         }       }     }     string actions;     cin >> actions;     int out = 0;     vector<pair<int, int>> mapping = {{-1, 0}, {0, -1}, {0, 1}, {1, 0}};     do {       bool found = false;       int x = start_x;       int y = start_y;       for (int i = 0; i < actions.size(); i++) {         int action = actions[i] -  0 ;         x += mapping[action].first;         y += mapping[action].second;         if (x < 0 || x >= n || y < 0 || y >= m || grid[x][y] ==  # ) {           break;         }         if (grid[x][y] ==  E ) {           found = true;           break;         }       }       out += found;     } while (next_permutation(mapping.begin(), mapping.end()));     printf( %d , out);   }   