#include <bits/stdc++.h>
using namespace std;
int main(void) {
  long long N, Q;
  cin >> N >> Q;
  string s;
  cin >> s;
  map<char, vector<int>> char_mp;
  map<int, int> int_mp;
  for (int i = 0; i < N; i++) {
    int_mp[i] = 1;
  }
  for (int i = 0; i < N; i++) {
    char_mp[s[i]].push_back(i);
  }
  long long sum = N;
  for (int i = 0; i < Q; i++) {
    char t, d;
    cin >> t >> d;
    for (int j = 0; j < char_mp[t].size(); j++) {
      if (d == 'L') {
        if (char_mp[t][j] == 0) {
          sum -= int_mp[char_mp[t][j]];
        } else {
          int_mp[char_mp[t][j] - 1] += int_mp[char_mp[t][j]];
        }
      } else if (d == 'R') {
        if (char_mp[t][j] == (N - 1)) {
          sum -= int_mp[char_mp[t][j]];
        } else {
          int_mp[char_mp[t][j] + 1] += int_mp[char_mp[t][j]];
        }
      }
      int_mp[char_mp[t][j]] = 0;
    }
  }
  cout << sum << endl;
}
