Advertisement
Zinak

Untitled

Aug 11th, 2019
131
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.71 KB | None | 0 0
  1. #include<bits/stdc++.h>
  2. using namespace std;
  3. typedef long long ll;
  4. int main()
  5. {
  6.     ll n,i=0,j=9,k,a;
  7.     string s,as;
  8.     as.assign(10,'0');
  9.     cin>>n;
  10.     cin>>s;
  11.     for(k=0; k<n; k++)
  12.     {
  13.         if(s[k]=='L')
  14.         {
  15.             for(i=0; i<9; i++)
  16.             {
  17.                 if(as[i]=='0')
  18.                     as[i]='1';
  19.                     break;
  20.             }
  21.         }
  22.         else if(s[k]=='R')
  23.         {
  24.             for(j=9; j<=0; j--)
  25.             {
  26.                 if(as[j]=='0')
  27.                     as[j]='1';
  28.                     break;
  29.             }
  30.         }
  31.         else
  32.         {
  33.             as[s[k]-'0']='0';
  34.  
  35.         }
  36.     }
  37.     cout<<as<<endl;
  38.     return 0;
  39. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement