#include <bits/stdc++.h>
using namespace std;
int main() {
  int N, Q;
  cin >> N >> Q;
  string s;
  cin >> s;
  int n = s.size();
  vector<char> t(Q), d(Q);
  vector<int> st(s.size());
  for (int i = 0; i < s.size(); ++i) {
    st[i] = i;
  }
  for (int i = 0; i < Q; ++i) {
    cin >> t[i] >> d[i];
    for (int j = 0; j < s.size(); ++j) {
      if (st[j] == -100) continue;
      if (s[j] == t[i]) {
        if (d[i] == 'L')
          --st[j];
        else
          ++st[j];
      }
      cout << st[j] << endl;
      if (st[j] == -1 || st[j] == s.size()) {
        st[j] = -100;
        --n;
      }
    }
  }
  cout << n << endl;
  return 0;
}
