#include <bits/stdc++.h>
using namespace std;
void print(const vector<int> &v) {
  for (const auto &x : v) {
    cout << x << " ";
  }
  cout << endl;
  return;
}
int main() {
  int N, Q, nd = 0;
  string s;
  char t, d;
  vector<vector<int>> m(26);
  cin >> N >> Q;
  cin >> s;
  vector<int> g(N + 2, 1);
  g[0] = g[N + 1] = 0;
  int ll = s.size();
  for (int i = 0; i < ll; ++i) {
    char c = s[i];
    m[static_cast<int>(c - 'A')].emplace_back(i + 1);
  }
  for (int i = 1; i <= Q; ++i) {
    cin >> t >> d;
    int k = static_cast<int>(t - 'A');
    int z = (d == 'L' ? -1 : 1);
    int l = m[k].size();
    if (z == -1) {
      for (int j = 0; j < l; ++j) {
        if (m[k][j] + z > 0) {
          g[m[k][j] + z] += g[m[k][j]];
        } else {
          nd += g[m[k][j]];
        }
        g[m[k][j]] = 0;
        if (Q - i < m[k][j] && m[k][j] < N - Q + i) {
          break;
        }
      }
    } else {
      for (int j = l - 1; j >= 0; --j) {
        if (m[k][j] + z <= N) {
          g[m[k][j] + z] += g[m[k][j]];
        } else {
          nd += g[m[k][j]];
        }
        g[m[k][j]] = 0;
        if (Q - i < m[k][j] && m[k][j] < N - Q + i) {
          break;
        }
      }
    }
  }
  cout << N - nd << endl;
  return 0;
}
