#include <bits/stdc++.h>   using namespace std;   char str[500005], cmd[500005];   int baam[500005], daan[500005], jora[500005];   int n, m, pos;   long long bit[500005];   void update(int l, int r) {     bit[l] += 1;     bit[r + 1] -= 1;   }   void moveLeft() {     if (baam[pos] > 0 && baam[pos] <= n) pos = baam[pos];     return;   }   void moveRight() {     if (daan[pos] > 0 && daan[pos] <= n) pos = daan[pos];     return;   }   void deleteNode() {     int nextPos, L, R;     L = min(pos, jora[pos]);     R = max(pos, jora[pos]);     if (daan[R] <= n)       pos = daan[R];     else       pos = baam[L];     daan[baam[L]] = daan[R];     baam[daan[R]] = baam[L];     update(L, R);     return;   }   int main() {     scanf( %d %d %d , &n, &m, &pos);     getchar();     for (int i = 1; i <= n; i++) scanf( %c , &str[i]);     getchar();     stack<int> st;     for (int i = 1; i <= n; i++) {       if (str[i] ==  ( )         st.push(i);       else {         jora[i] = st.top();         jora[st.top()] = i;         st.pop();       }     }     for (int i = 1; i <= n; i++) {       baam[i] = i - 1;       daan[i] = i + 1;     }     scanf( %s , cmd);     for (int i = 0; cmd[i]; i++) {       if (cmd[i] ==  L )         moveLeft();       else if (cmd[i] ==  R )         moveRight();       else         deleteNode();     }     for (int i = 1; i <= n; i++) bit[i] += bit[i - 1];     for (int i = 1; i <= n; i++) {       if (!bit[i]) printf( %c , str[i]);     }     puts(  );   }   