func_code_string: #include <bits/stdc++.h>   using namespace std;   const double PI = 3.1415926536;   int n, m, spaces;   bool a[100005], vis[505][505];   void walk(int x, int y, string s) {     int counter = 1;     for (int i = 0; i < s.size(); i++) {       if (s[i] ==  U ) {         if (x > 1) {           x--;           if (!vis[x][y]) spaces--, vis[x][y] = 1, a[counter] = 1;         }       } else if (s[i] ==  D ) {         if (x < n) {           x++;           if (!vis[x][y]) spaces--, vis[x][y] = 1, a[counter] = 1;         }       } else if (s[i] ==  R ) {         if (y < m) {           y++;           if (!vis[x][y]) spaces--, vis[x][y] = 1, a[counter] = 1;         }       } else {         if (y > 1) {           y--;           if (!vis[x][y]) spaces--, vis[x][y] = 1, a[counter] = 1;         }       }       counter++;     }     if (a[s.size()]) spaces++;   }   int main() {     int x, y;     string s;     cin >> n >> m >> x >> y >> s;     spaces = n * m - 1;     vis[x][y] = 1;     walk(x, y, s);     cout <<  1  ;     for (int i = 1; i < s.size(); i++) cout << a[i] <<    ;     cout << spaces <<   n ;     return 0;   }   