use std::io::Read; fn main() { let mut s = String::new(); std::io::stdin().read_to_string(&mut s).ok(); let l: Vec<_> = s.split_whitespace().collect(); let n = l[0].parse::().unwrap() + 1; let mut a = vec!["1"; n * n]; let (mut x, mut y) = (0, 0); a[0] = "0"; for d in l[2].chars() { match d { 'U' => y = (y + 1) % n, 'D' => y = (y + n - 1) % n, 'L' => x = (x + 1) % n, 'R' => x = (x + n - 1) % n, _ => (), } a[x + y * n] = "0"; } a.chunks(n).rev().for_each(|r| println!("{}", r.join(" "))); }