#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int INF = numeric_limits<int>::max() / 2;
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n, q;
  cin >> n >> q;
  string s;
  cin >> s;
  int g = n;
  map<char, vector<int> > mp;
  for (int i = 0; i < s.size(); i++) {
    mp[s[i]].push_back(i);
  }
  for (int i = 0; i < q; i++) {
    char t, d;
    cin >> t >> d;
    map<char, vector<int> > mp2 = mp;
    mp2[t].clear();
    mp2[t].shrink_to_fit();
    for (int item : mp[t]) {
      if (d == 'R') {
        if (item == (n - 1)) {
          g--;
        } else {
          mp2[s[item + 1]].push_back(item + 1);
        }
      } else {
        if (item == 0) {
          g--;
        } else {
          mp2[s[item - 1]].push_back(item - 1);
        }
      }
    }
    mp = mp2;
  }
  cout << g << endl;
  return 0;
}
