#include <bits/stdc++.h>
using namespace std;
using ll = unsigned long long;
ll mo = 1e9 + 7;
int main() {
  int n, q;
  cin >> n >> q;
  string s;
  cin >> s;
  map<char, vector<int>> m;
  for (int i = 0; i < n; ++i) {
    m[s[i]].push_back(i);
  }
  for (int i = 0; i < q; ++i) {
    char t, d;
    cin >> t >> d;
    if (m.count(t) == 0) continue;
    vector<int> tmp;
    if (d == 'R') {
      for (int j = 0; j < (int)m[t].size(); ++j) {
        if (m[t][j] != n - 1) {
          if (s[m[t][j]] == s[m[t][j] + 1]) {
            tmp.push_back(m[t][j] + 1);
          } else
            m[s[m[t][j] + 1]].push_back(m[t][j] + 1);
        }
      }
      m[t].clear();
      if (!tmp.empty()) m[t] = tmp;
    } else {
      for (int j = 0; j < (int)m[t].size(); ++j) {
        if (m[t][j] != 0) {
          if (s[m[t][j]] == s[m[t][j] - 1]) {
            tmp.push_back(m[t][j] - 1);
          } else
            m[s[m[t][j] - 1]].push_back(m[t][j] - 1);
        }
      }
      m[t].clear();
      if (!tmp.empty()) m[t] = tmp;
    }
  }
  int ret = 0;
  for (auto b : m) {
    ret += b.second.size();
  }
  cout << ret << endl;
  return 0;
}
