package main import ( "bufio" "fmt" "os" "strconv" "strings" ) func main() { sc := bufio.NewScanner(os.Stdin) sc.Buffer(make([]byte, 1000000+2), 1000000+2) sc.Scan() ss := strings.Fields(sc.Text()) n, _ := strconv.Atoi(ss[0]) //m, _ := strconv.Atoi(ss[1]) sc.Scan() s := sc.Text() mm := make([][]bool, 1+n) for b := 0; b <= n; b++ { mm[b] = make([]bool, 1+n) } a, b := 0, 0 mm[b][a] = true // ate for _, c := range s { switch c { case 'U': b++ case 'R': a++ case 'L': a-- case 'D': b-- } mm[b][a] = true // ate } for b := n; b >= 0; b-- { for a := 0; a <= n; a++ { if mm[b][a] { fmt.Print(0) } else { fmt.Print(1) } if a < n { fmt.Print(" ") } else { fmt.Println() } } } }