#include <bits/stdc++.h>
using namespace std;
int main() {
  int N, Q;
  cin >> N >> Q;
  string s;
  cin >> s;
  int s_size = s.size();
  map<char, vector<int> > dic;
  vector<int> m(N + 2);
  for (int i = 0; i < s_size; i++) {
    dic[s[i]].push_back(i + 1);
  }
  for (int i = 0; i <= N; i++) {
    m[i] = 1;
  }
  for (int n = 0; n < Q; n++) {
    char pos, arg;
    cin >> pos >> arg;
    int m_size = dic[pos].size();
    for (int i = 0; i < m_size; i++) {
      if (arg == 'L') {
        m[dic[pos][i] - 1] += m[dic[pos][i]];
      } else {
        m[dic[pos][i] + 1] += m[dic[pos][i]];
      }
      m[dic[pos][i]] = 0;
    }
  }
  int result = N + 1 - m[0] - m[N + 1];
  cout << result << endl;
}
