#include <bits/stdc++.h>
using namespace std;
int main() {
  int N, Q;
  cin >> N >> Q;
  string s;
  cin >> s;
  vector<string> t(N + 2);
  vector<char> d(N + 2);
  vector<int> g(N + 2);
  for (int i = 1; i <= Q; i++) {
    cin >> t.at(i) >> d.at(i);
  }
  for (int i = 1; i <= N; i++) {
    g.at(i) = 1;
  }
  int now;
  for (int i = 1; i <= Q; i++) {
    for (int j = 1; j <= N; j++) {
      if (t.at(i) == t.at(j)) {
        if (d.at(i) == 'R') {
          g.at(j)--;
          g.at(j + 1)++;
        } else {
          g.at(j)--;
          g.at(j - 1)++;
        }
      }
    }
  }
  int sum = 0;
  for (int i = 1; i <= N; i++) {
    sum += g.at(i);
  }
  cout << sum << endl;
}
