#include <bits/stdc++.h>
using namespace std;
int main() {
  int N, Q;
  cin >> N >> Q;
  char S[N];
  cin >> S;
  char t, d;
  int ts = -1, te = N;
  for (int q = 0; q < Q; q++) {
    cin >> t >> d;
    cout << t << d << endl;
    for (int i = Q - 1; i >= 0; i--) {
      if (te - ts <= 1) break;
      if (d == 'L') {
        if (ts < N - 1 && S[ts + 1] == t) ts++;
        if (te < N && S[te] == t) te++;
      } else if (d == 'R') {
        if (0 <= ts && S[ts] == t) ts--;
        if (0 < te && S[te - 1] == t) te--;
      }
    }
  }
  cout << N - (ts + 1 + N - te) << endl;
  return 0;
}
