n, m = map(int, input().split()) s = input() ans = [[1]*(n+1) for _ in range(n+1)] ans[n][0] = 0 x, y = 0, 0 for si in s: if si=='U': y += 1 elif si=='D': y -= 1 elif si=='R': x += 1 else: x -= 1 ans[n-y][x] = 0 for ans_i in ans: print(*ans_i)