Hotelier

题意翻译

Amugae有一家10间客房的酒店,房间从左到右从0到9编号。 酒店有两个入口——一个在左端,另一个在右端。当顾客通过左边入口到达酒店时,他们被分配到离左边入口最近的那个空房间。同样,当客户通过右边的入口到达酒店时,他们被分配到离右边入口最近的那个空房间。 一天,Amugae失去了房间分配表单。谢天谢地,Amugae的记忆是完好的,他还记得所有的顾客:顾客什么时候到的,从哪个入口进入的酒店,以及他们什么时候离开酒店。最初这家酒店的房间都是空的。编写一个程序,从Amugae的记忆中恢复房间分配表单。 ## 输入格式 第一行包含一个整数n(1≤n≤100000),表示Amugae记忆中的事件数。 第二行由一个长度为n的字符串组成,按时间顺序描述事件。其中每个字符含义: “L”:表示客户从左侧入口进入酒店。 “R”:表示客户从右侧入口进入酒店。 '0'、'1'、…、'9':X房间的客户(分别为0、1、…、 9)离开。 数据保证客户到达时至少有一个空房间,且当X(0,1,…,9)给出时,X房间内有一个客户。并且,所有房间最初都是空的。 ## 输出格式 一行,输出酒店房间的分配状态,从0房间到9房间。将空房间表示为“0”,占用的房间表示为“1”,没有空格。 **输入输出示例** _**Mubuky's Translation**_

题目描述

Amugae has a hotel consisting of $ 10 $ rooms. The rooms are numbered from $ 0 $ to $ 9 $ from left to right. The hotel has two entrances — one from the left end, and another from the right end. When a customer arrives to the hotel through the left entrance, they are assigned to an empty room closest to the left entrance. Similarly, when a customer arrives at the hotel through the right entrance, they are assigned to an empty room closest to the right entrance. One day, Amugae lost the room assignment list. Thankfully Amugae's memory is perfect, and he remembers all of the customers: when a customer arrived, from which entrance, and when they left the hotel. Initially the hotel was empty. Write a program that recovers the room assignment list from Amugae's memory.

输入输出格式

输入格式


The first line consists of an integer $ n $ ( $ 1 \le n \le 10^5 $ ), the number of events in Amugae's memory. The second line consists of a string of length $ n $ describing the events in chronological order. Each character represents: - 'L': A customer arrives from the left entrance. - 'R': A customer arrives from the right entrance. - '0', '1', ..., '9': The customer in room $ x $ ( $ 0 $ , $ 1 $ , ..., $ 9 $ respectively) leaves. It is guaranteed that there is at least one empty room when a customer arrives, and there is a customer in the room $ x $ when $ x $ ( $ 0 $ , $ 1 $ , ..., $ 9 $ ) is given. Also, all the rooms are initially empty.

输出格式


In the only line, output the hotel room's assignment status, from room $ 0 $ to room $ 9 $ . Represent an empty room as '0', and an occupied room as '1', without spaces.

输入输出样例

输入样例 #1

8
LLRL1RL1

输出样例 #1

1010000011

输入样例 #2

9
L0L0LLRR9

输出样例 #2

1100000010

说明

In the first example, hotel room's assignment status after each action is as follows. - First of all, all rooms are empty. Assignment status is 0000000000. - L: a customer arrives to the hotel through the left entrance. Assignment status is 1000000000. - L: one more customer from the left entrance. Assignment status is 1100000000. - R: one more customer from the right entrance. Assignment status is 1100000001. - L: one more customer from the left entrance. Assignment status is 1110000001. - 1: the customer in room $ 1 $ leaves. Assignment status is 1010000001. - R: one more customer from the right entrance. Assignment status is 1010000011. - L: one more customer from the left entrance. Assignment status is 1110000011. - 1: the customer in room $ 1 $ leaves. Assignment status is 1010000011. So after all, hotel room's final assignment status is 1010000011. In the second example, hotel room's assignment status after each action is as follows. - L: a customer arrives to the hotel through the left entrance. Assignment status is 1000000000. - 0: the customer in room $ 0 $ leaves. Assignment status is 0000000000. - L: a customer arrives to the hotel through the left entrance. Assignment status is 1000000000 again. - 0: the customer in room $ 0 $ leaves. Assignment status is 0000000000. - L: a customer arrives to the hotel through the left entrance. Assignment status is 1000000000. - L: one more customer from the left entrance. Assignment status is 1100000000. - R: one more customer from the right entrance. Assignment status is 1100000001. - R: one more customer from the right entrance. Assignment status is 1100000011. - 9: the customer in room $ 9 $ leaves. Assignment status is 1100000010. So after all, hotel room's final assignment status is 1100000010.