N, M = map(int, input().split()) S = input() DP = [[1 for _ in range(N+1)] for _ in range(N+1)] DP[0][0] = 0 X, Y = 0, 0 for c in S: if c == "U": Y += 1 elif c == "R": X += 1 elif c == "L": X -= 1 else: Y -= 1 DP[Y][X] = 0 for i in range(N + 1): print(*DP[N - i])