#include <bits/stdc++.h>
using namespace std;
int main() {
  int N, Q;
  string s;
  char t;
  char d;
  cin >> N >> Q >> s;
  vector<int> golem(N);
  vector<int> move(N, 0);
  vector<int> moved(N, 0);
  for (int i = 0; i < N; i++) {
    golem[i] = 1;
  }
  for (int i = 0; i < Q; i++) {
    cin >> t >> d;
    for (int j = 0; j < N; j++) {
      if (t == s[j]) {
        move[j] = golem[j];
        moved[j] = golem[j];
      }
    }
    if (d == 'R') {
      moved.insert(moved.begin(), 0);
      moved.pop_back();
    } else if (d == 'L') {
      moved.push_back(0);
      moved.erase(moved.begin());
    }
    for (int j = 0; j < N; j++) {
      golem[j] -= move[j];
      golem[j] += moved[j];
      move[j] = 0;
      moved[j] = 0;
    }
  }
  int count = 0;
  for (int i = 0; i < N; i++) {
    count += golem[i];
  }
  cout << count << endl;
}
