#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, q, de_cnt = 0;
  string s;
  char tt, td;
  vector<char> d, t;
  vector<pair<int, char>> gr;
  cin >> n >> q;
  cin >> s;
  for (int i = 0; i < n; i++) {
    gr.push_back(make_pair(i + 1, s[i]));
  }
  for (int i = 0; i < q; i++) {
    cin >> tt >> td;
    d.push_back(td);
    t.push_back(tt);
  }
  for (int i = 0; i < q; i++) {
    for (auto j = gr.begin(); j != gr.end(); j++) {
      if (j->second == t[i]) {
        j->first += (d[i] == 'R') ? 1 : -1;
        if (j->first <= 0 || j->first >= n) {
          j = gr.erase(j);
          j--;
        } else {
          j->second = s[j->first - 1];
        }
      }
    }
  }
  cout << gr.size() << endl;
}
