#include <bits/stdc++.h>
using namespace std;
int main(void) {
  int N, Q;
  cin >> N;
  cin >> Q;
  std::map<char, std::tuple<std::vector<bool>, int, int>> data;
  string s;
  cin >> s;
  string ABC = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
  bool isEx[26] = {false};
  for (int i = 0; i < 26; i++) isEx[i] = s.find(ABC[i]) != std::string::npos;
  std::vector<bool> Init_list(N);
  std::tuple<std::vector<bool>, int, int> tup;
  std::get<0>(tup) = Init_list;
  std::get<1>(tup) = 0;
  std::get<2>(tup) = 0;
  for (int i = 0; i < 26; i++) {
    if (isEx[i] == false) continue;
    data.insert(std::make_pair(ABC[i], tup));
  }
  for (int i = 0; i < s.size(); i++) {
    std::get<0>(data[s[i]])[i] = true;
    std::get<1>(data[s[i]])++;
  }
  for (int i = 0; i < 26; i++) {
    if (isEx[i] == false) continue;
    printf("Test :%d: \n", std::get<1>(data[ABC[i]]));
  }
  char t, d;
  for (int i = 0; i < Q; i++) {
    cin >> t;
    cin >> d;
    if (d == 'R') {
      std::get<2>(data[t])++;
      if (std::get<2>(data[t]) > 0) {
        if (std::get<0>(data[t])[N - std::get<2>(data[t])] == true) {
          std::get<0>(data[t])[N - std::get<2>(data[t])] = false;
          std::get<1>(data[t])--;
        }
      }
    } else if (d == 'L') {
      std::get<2>(data[t])--;
      if (std::get<2>(data[t]) < 1) {
        if (std::get<0>(data[t])[1 - std::get<2>(data[t])] == true) {
          std::get<0>(data[t])[1 - std::get<2>(data[t])] = false;
          std::get<1>(data[t])--;
        }
      }
    }
  }
  int res = 0;
  for (int i = 0; i < 26; i++) {
    if (isEx[i] == false) continue;
    res += std::get<2>(data[ABC[i]]);
  }
  std::cout << res << endl;
ProgramEndPointLabel:;
  system("pause");
  return 0;
}
