Under construction

Still being built. Things may change

Hotelier

Interview

Time limit1sMemory limit256 MB

Summary
Simulate customers entering a 10-room hotel from the left or right end and leaving by room number, then print which rooms are occupied at the end.
Level

Easy2 of 10

Topics
Simulation, Implementation
Solved
No attempts yet

Problem

Amugae has a hotel consisting of 1010 rooms. The rooms are numbered from 00 to 99 from left to right.

The hotel has two entrances, one at the left end and another at the right end. When a customer arrives through the left entrance, they are assigned to the empty room closest to the left entrance. Similarly, when a customer arrives through the right entrance, they are assigned to the empty room closest to the right entrance.

One day, Amugae lost the room assignment list. Thankfully, Amugae's memory is perfect, and he remembers every customer: when each one arrived, through 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.

Input

The first line contains an integer nn (1≤n≤1051 \le n \le 10^5), the number of events in Amugae's memory.

The second line contains a string of length nn describing the events in chronological order. Each character means the following.

  • L: A customer arrives through the left entrance.
  • R: A customer arrives through the right entrance.
  • 0, 1, ..., 9: The customer in room xx (00, 11, ..., 99 respectively) leaves.

When a customer arrives, there is always at least one empty room. When a digit is given, there is a customer in that room. Initially all rooms are empty.

Output

Print the room assignment status from room 00 to room 99 in one line. Write an empty room as 0 and an occupied room as 1, without spaces.

Hint

In the first example, the status after each action is as follows.

  • Initially all rooms are empty. Status is 0000000000.
  • L: A customer arrives through the left entrance. Status is 1000000000.
  • L: Another customer arrives through the left entrance. Status is 1100000000.
  • R: A customer arrives through the right entrance. Status is 1100000001.
  • L: A customer arrives through the left entrance. Status is 1110000001.
  • 1: The customer in room 11 leaves. Status is 1010000001.
  • R: A customer arrives through the right entrance. Status is 1010000011.
  • L: A customer arrives through the left entrance. Status is 1110000011.
  • 1: The customer in room 11 leaves. Status is 1010000011.

So the final status is 1010000011.

In the second example, the status after each action is as follows.

  • L: A customer arrives through the left entrance. Status is 1000000000.
  • 0: The customer in room 00 leaves. Status is 0000000000.
  • L: A customer arrives through the left entrance. Status is 1000000000 again.
  • 0: The customer in room 00 leaves. Status is 0000000000.
  • L: A customer arrives through the left entrance. Status is 1000000000.
  • L: Another customer arrives through the left entrance. Status is 1100000000.
  • R: A customer arrives through the right entrance. Status is 1100000001.
  • R: Another customer arrives through the right entrance. Status is 1100000011.
  • 9: The customer in room 99 leaves. Status is 1100000010.

So the final status is 1100000010.

Examples2

  1. Example 1

    Input
    8
    LLRL1RL1
    
    Expected output
    1010000011
    
  2. Example 2

    Input
    9
    L0L0LLRR9
    
    Expected output
    1100000010