#include using ll = long long; using namespace std; int main() { ios::sync_with_stdio(false); cin.tie(nullptr); int n, m; string s; cin >> n >> m >> s; ++n; int x{ 0 }, y{ 0 }; int res[n][n]; for (int i = 0; i < n; ++i) fill(res[i], res[i]+n, 1); res[0][0] = 0; for (const auto& ss : s) { if (ss == 'U') { y += 1; res[y][x] = 0; } else if (ss == 'D') { y -= 1; res[y][x] = 0; } else if (ss == 'R') { x += 1; res[y][x] = 0; } else if (ss == 'L') { x -= 1; res[y][x] = 0; } } for (int i = n - 1; i >= 0; --i) { for (int j = 0; j < n - 1; ++j) cout << res[i][j] << " "; cout << res[i][n - 1] << "\n"; } return 0; }