#include <bits/stdc++.h>
using namespace std;
int main() {
  vector<long long> v(100010, 1);
  int a;
  long long b;
  string s;
  cin >> a >> b >> s;
  int indx = 0;
  char point;
  char command;
  for (long long i = 0; i < b; i++) {
    cin >> point >> command;
    if (command == 'R') {
      int index = 0;
      for (char c : s) {
        if (point == c) {
          if (index == a - 1)
            v[index] = 0;
          else {
            v[index + 1] = v[index + 1] + v[index];
            v[index] = 0;
          }
        }
        index++;
      }
    } else {
      int index = 0;
      for (char c : s) {
        if (point == c) {
          if (index == 0)
            v[index] = 0;
          else {
            v[index - 1] = v[index - 1] + v[index];
            v[index] = 0;
          }
        }
        index++;
      }
    }
  }
  long long ans = 0;
  for (long long index = 0; index < a; index++) {
    ans += v[index];
  }
  cout << ans;
  return 0;
}
