N, M = map(int, input().split()) S = input() dp = [[1 for _ in range(N+1)] for _ in range(N+1)] dp[0][0] = 0 now = [0, 0] for s in S: if s=="U": now[1]+=1 elif s=="R": now[0]+=1 elif s=="L": now[0]-=1 else: now[1]-=1 x, y = now dp[y][x] = 0 for i in range(N+1): print(*dp[N-i])