Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- bool used[10];
- signed main()
- {
- int n;
- string s;
- cin >> n;
- cin >> s;
- for(int i = 0; i < n; i++){
- if(s[i] == 'L'){
- for(int j = 0; j <= 9; j++){
- if(!used[j]){
- used[j] = true;
- break;
- }
- }
- }
- if(s[i] == 'R'){
- for(int j = 9; j >= 0; j--){
- if(!used[j]){
- used[j] = true;
- break;
- }
- }
- }
- if((s[i] >= '0') && (s[i] <= '9')){
- used[s[i] - 48] = false;
- }
- }
- for(int i = 0; i <= 9; i++)
- cout << used[i];
- cout << endl;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement