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