#include <bits/stdc++.h>
using namespace std;
int main() {
  int a, b;
  string str;
  cin >> a >> b >> str;
  vector<int> monster;
  monster.reserve(a);
  monster = {};
  for (int i = 0; i < a; i++) {
    monster.push_back(1);
  }
  for (int i = 0; i < b; i++) {
    char pos, dir;
    cin >> pos >> dir;
    for (int j = 0; j < a; j++) {
      if (pos == str[j]) {
        if (dir == 'R') {
          if (j != a - 1) monster[j + 1] += monster[j];
          monster[j] = 0;
        } else if (dir == 'L') {
          if (j != 0) monster[j - 1] += monster[j];
          monster[j] = 0;
        }
      }
    }
  }
  cout << accumulate(monster.begin(), monster.end(), 0) << endl;
}
