#include <bits/stdc++.h>
using namespace std;
int main(void) {
  int i = 0, j, num, spl, ans = 0;
  string map, pos, buf;
  cin >> num >> spl >> map;
  vector<int> data(num, 1);
  for (; i < spl; i++) {
    cin >> pos >> buf;
    if (pos[0] == map[0]) {
      if (buf[0] == 'R')
        data[1] += data[0];
      else
        ans += data[0];
      data[0] = 0;
    }
    for (j = 1; j < num - 1; j++) {
      if (pos[0] != map[j]) continue;
      if (buf[0] == 'R')
        data[j + 1] += data[j];
      else
        data[j - 1] += data[j];
      data[j] = 0;
    }
    if (pos[0] == map[j]) {
      if (buf[0] == 'L')
        data[j - 1] += data[j];
      else
        ans += data[j];
      data[j] = 0;
    }
  }
  cout << num - ans << "\n";
  return 0;
}
