#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; int main() { int32_t n, m; string s; cin >> n >> m >> s; vector> mat(n + 1, vector(n + 1)); int32_t x = 0, y = 0; mat[0][0] = true; for (auto c : s) { if (c == 'U') ++y; else if (c == 'R') ++x; else if (c == 'L') --x; else --y; mat[x][y] = true; } for (auto yi = n; yi >= 0; --yi) { for (auto xi = 0; xi <= n; ++xi) { cout << !mat[xi][yi] << (xi == n ? '\n' : ' '); } } return 0; }