#include <bits/stdc++.h>   using namespace std;   multimap<long long int, long long int> par;   char en =   n ;   long long int inf = pow(10, 14);   long long int mod = 1e9 + 7;   long long int parent[2][500005];   long long int findRoot(long long int a, long long int which) {     if (parent[which][a] == a) return a;     parent[which][a] = findRoot(parent[which][a], which);     return parent[which][a];   }   void union1(long long int a, long long int b) {     long long int root1 = findRoot(a, 0);     long long int root2 = findRoot(b, 0);     if (root1 == root2) return;     long long int root11 = findRoot(a, 1);     long long int root21 = findRoot(b, 1);     if (root1 < root2) {       parent[0][root1] = root2;     } else {       parent[0][root2] = root1;     }     if (root11 > root21) {       parent[1][root11] = root21;     } else {       parent[1][root21] = root11;     }   }   int main() {     ios_base::sync_with_stdio(false);     cin.tie(NULL);     long long int n, m, p;     cin >> n >> m >> p;     string s;     cin >> s;     char arr[500005];     for (long long int i = 1; i < n + 1; i += 1) {       arr[i] = s[i - 1];       parent[0][i] = parent[1][i] = i;     }     bool visited[500005];     memset(visited, (false), sizeof(visited));     string s1;     cin >> s1;     long long int curr = p;     for (long long int i = 0; i < s1.length(); i += 1) {       if (s1[i] ==  R ) {         if (visited[curr + 1])           curr = findRoot(curr + 1, 0) + 1;         else           curr++;       } else if (s1[i] ==  L ) {         if (visited[curr - 1])           curr = findRoot(curr - 1, 1) - 1;         else           curr--;       } else {         if (arr[curr] ==  ( ) {           stack<char> st;           while (curr <= n) {             visited[curr] = true;             if (visited[curr - 1]) union1(curr - 1, curr);             if (visited[curr + 1]) union1(curr + 1, curr);             if (arr[curr] ==  ( ) {               st.push( ( );             } else {               st.pop();             }             if (st.empty()) {               long long int temp;               temp = findRoot(curr, 0) + 1;               if (temp > n) {                 temp = findRoot(curr, 1) - 1;               }               curr = temp;               break;             }             curr = findRoot(curr, 0) + 1;           }         } else {           stack<char> st;           while (curr >= 1) {             visited[curr] = true;             if (visited[curr - 1]) union1(curr - 1, curr);             if (visited[curr + 1]) union1(curr + 1, curr);             if (arr[curr] ==  ) ) {               st.push( ) );             } else {               st.pop();             }             if (st.empty()) {               long long int temp;               temp = findRoot(curr, 0) + 1;               if (temp > n) {                 temp = findRoot(curr, 1) - 1;               }               curr = temp;               break;             }             curr = findRoot(curr, 1) - 1;           }         }       }     }     for (long long int i = 1; i < n + 1; i += 1) {       if (!visited[i]) cout << arr[i];     }     return 0;   }   