#include <bits/stdc++.h>
using namespace std;
vector<vector<string>> getinputdata();
vector<vector<int>> getinputdata2();
vector<vector<double>> getinputdata3();
vector<vector<string>> vec_check(vector<vector<string>> vec, string t, string d,
                                 string s, int n) {
  vector<vector<string>> vec_temp = vec;
  for (int i = 0; i < vec_temp.size(); i++) {
    vector<string> v = vec[i];
    for (int j = 0; j < v.size(); j++) {
      if (v[j] == t) {
        if (d == "L" && i == 0) {
          vec_temp[i][j] = "";
        }
        if (d == "L" && i != 0) {
          vec_temp[i - 1].push_back(s.substr(i - 1, 1));
          vec_temp[i][j] = "";
        }
        if (d == "R" && i == n - 1) {
          vec_temp[i][j] = "";
        }
        if (d == "R" && i != n - 1) {
          vec_temp[i + 1].push_back(s.substr(i + 1, 1));
          vec_temp[i][j] = "";
        }
      }
    }
  }
  return vec_temp;
}
void exawizards2019_c(vector<vector<string>> v) {
  int n = atoi(v[0][0].c_str());
  int q = atoi(v[0][1].c_str());
  string s = v[1][0];
  vector<vector<string>> vec;
  for (int j = 0; j < s.size(); j++) {
    vector<string> vec_temp;
    vec_temp.push_back(s.substr(j, 1));
    vec.push_back(vec_temp);
  }
  for (int i = 2; i < 2 + q; i++) {
    string t = v[i][0];
    string d = v[i][1];
    vec = vec_check(vec, t, d, s, n);
  }
  int cnt = 0;
  for (int i = 0; i < vec.size(); i++) {
    vector<string> vtemp01 = vec[i];
    for (int j = 0; j < vtemp01.size(); j++) {
      if (vtemp01[j] != "") {
        cnt += 1;
      }
    }
  }
  cout << cnt << endl;
}
int main() {
  vector<vector<string>> vec_arr_result;
  vec_arr_result = getinputdata();
  exawizards2019_c(vec_arr_result);
  return 0;
}
vector<vector<double>> getinputdata3() {
  string str;
  string ret;
  stringstream ss;
  vector<string> v1;
  vector<vector<double>> vec_arr;
  while (getline(cin, str)) {
    v1.push_back(str);
  }
  for (string s : v1) {
    vector<double> array_data;
    ss << s;
    while (!ss.eof()) {
      ss >> ret;
      array_data.push_back(atof(ret.c_str()));
    }
    vec_arr.push_back(array_data);
    ss.str("");
    ss.clear(stringstream::goodbit);
  }
  return vec_arr;
}
vector<vector<int>> getinputdata2() {
  string str;
  string ret;
  stringstream ss;
  vector<string> v1;
  vector<vector<int>> vec_arr;
  while (getline(cin, str)) {
    v1.push_back(str);
  }
  for (string s : v1) {
    vector<int> array_data;
    ss << s;
    while (!ss.eof()) {
      ss >> ret;
      array_data.push_back(atoi(ret.c_str()));
    }
    vec_arr.push_back(array_data);
    ss.str("");
    ss.clear(stringstream::goodbit);
  }
  return vec_arr;
}
vector<vector<string>> getinputdata() {
  string str;
  string ret;
  stringstream ss;
  vector<string> v1;
  vector<vector<string>> vec_arr;
  while (getline(cin, str)) {
    v1.push_back(str);
  }
  for (string s : v1) {
    vector<string> array_data;
    ss << s;
    while (!ss.eof()) {
      ss >> ret;
      array_data.push_back(ret);
    }
    vec_arr.push_back(array_data);
    ss.str("");
    ss.clear(stringstream::goodbit);
  }
  return vec_arr;
}
