#include <bits/stdc++.h>
using namespace std;
int find(int p, string s, int t) {
  while (1) {
    if (p < s.size()) {
      if (s[p] == t)
        return p;
      else
        ++p;
    } else
      return -1;
  }
}
template <typename iterator>
void majicshift(string s, iterator begin, int N) {
  char t, d;
  cin >> t >> d;
  int p = s.find_first_of(t);
  while (p >= 0) {
    if (d == 'L') {
      if (p > 0) *(begin + (p - 1)) += *(begin + p);
    } else {
      if (p < (N - 1)) *(begin + (p + 1)) += *(begin + p);
    }
    *(begin + p) = 0;
    p = find(++p, s, t);
  }
}
int main(void) {
  int N, Q;
  string s;
  cin >> N >> Q >> s;
  vector<int> Golems(N, 1);
  while (Q--) majicshift(s, Golems.begin(), N);
  int sum = 0;
  while (N--) sum += Golems.at(N);
  cout << sum << endl;
}
