#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, q;
  cin >> n >> q;
  string s;
  cin >> s;
  vector<std::pair<char, char>> moves;
  map<char, map<int, int>> golems;
  for (int i = 0; i < s.length(); ++i) {
    golems[s[i]][i] = 1;
  }
  for (int i = 0; i < q; ++i) {
    char c, dir;
    cin >> c >> dir;
    if (dir == 'L') {
      for (auto it = golems[c].begin(); it != golems[c].end(); ++it) {
        int index = it->first;
        int num_golems = it->second;
        it->second = 0;
        if (index > 0) {
          golems[s[index - 1]][index - 1] += num_golems;
        }
      }
    } else {
      for (auto it = golems[c].begin(); it != golems[c].end(); ++it) {
        int index = it->first;
        int num_golems = it->second;
        it->second = 0;
        if (index < n - 1) {
          golems[s[index + 1]][index + 1] += num_golems;
        }
      }
    }
  }
  int sum = 0;
  for (auto it = golems.begin(); it != golems.end(); ++it) {
    for (auto itt = (it->second).begin(); itt != (it->second).end(); ++itt) {
      sum += itt->second;
    }
  }
  cout << sum;
}
