#include using namespace std; int main(){ int n, m, y, x; string s; cin >> n >> m >> s; y = n++, x = 0; vector> ans(n, vector(n, 1)); ans[y][x] = 0; for(int i = 0; i < m; i++){ if(s[i] == 'U')y--; if(s[i] == 'D')y++; if(s[i] == 'R')x++; if(s[i] == 'L')x--; ans[y][x] = 0; } for(int i = 0; i < n; i++){ for(int j = 0; j < n; j++){ if(j)cout << ' '; cout << ans[i][j]; } cout << '\n'; } }