fn main() { let mut nm = String::new(); std::io::stdin().read_line(&mut nm).ok(); let nm: Vec = nm.trim().split_whitespace().map(|s| s.parse().unwrap()).collect(); let n = nm[0]; let mut s = String::new(); std::io::stdin().read_line(&mut s).ok(); let mut pos: (isize, isize) = (0, 0); let mut mapping: Vec> = vec![vec![1; n as usize +1]; n as usize +1]; mapping[0][0] = 0; s.trim().chars().for_each(|c| { match c { 'U' => { pos.0 += 1; }, 'D' => { pos.0 -= 1; }, 'R' => { pos.1 += 1; }, 'L' => { pos.1 -= 1; }, _ => {}, } if pos.0 >= 0 && pos.0 <= n && pos.1 >= 0 && pos.1 <= n { mapping[pos.0 as usize][pos.1 as usize] = 0; } }); mapping.iter().rev().for_each(|line| { println!("{}", line.iter().map(|i| i.to_string()).collect::>().join(" ")); }); }