#include <bits/stdc++.h>
using namespace std;
struct line {
  line *prev;
  line *next;
  char c;
  int golem;
};
struct chars {
  chars *next;
  line *ptr;
};
chars crs[1000];
void makeChain(int c, line *ptr) {
  chars tmp = crs[c];
  while (tmp.ptr != NULL) {
    tmp = *tmp.next;
  }
  tmp.ptr = ptr;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  int N, Q;
  string s;
  char t, d;
  cin >> N >> Q >> s;
  line head = {NULL, NULL, s[0], 1};
  line *prev = &head;
  for (int i = 1; i < (int)s.size(); i++) {
    line tmp = {prev, NULL, s[i], 1};
    makeChain(s[i], &tmp);
    prev->next = &tmp;
    prev = &tmp;
    cout << "hoge" << endl;
  }
  while (cin >> t >> d) {
    chars cr = crs[(int)t];
    while (cr.ptr != NULL) {
      switch (d) {
        case 'R':
          if (cr.ptr->next != NULL) {
            cr.ptr->next->golem++;
          }
          break;
        case 'L':
          if (cr.ptr->prev != NULL) {
            cr.ptr->prev->golem++;
          }
          break;
      }
      cr.ptr->golem--;
    }
  }
  int ans = 0;
  auto ptr = &head;
  while (ptr != NULL) {
    ans += ptr->golem;
    ptr = ptr->next;
  }
  cout << ans << endl;
}
