#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  std::string input;
  std::getline(std::cin, input, ' ');
  int N = std::stoi(input);
  std::getline(std::cin, input);
  int Q = std::stoi(input);
  std::string squares;
  std::getline(std::cin, squares);
  std::vector<std::string> spells;
  while (std::getline(std::cin, input)) {
    spells.emplace_back(input);
  }
  std::vector<int> golems(N, 1);
  std::unordered_map<char, vector<int>> mapper;
  for (int inx = 0; inx < N; inx += 1) {
    mapper[squares[inx]].emplace_back(inx);
  }
  for (std::string& input : spells) {
    vector<int> squares = mapper[input[0]];
    vector<int> preGolems(golems);
    for (int& inx : squares) {
      if (input[2] == 'L') {
        if (inx > 0) {
          golems[inx - 1] += preGolems[inx];
        }
        golems[inx] -= preGolems[inx];
      } else {
        if (inx < N - 1) {
          golems[inx + 1] += preGolems[inx];
        }
        golems[inx] -= preGolems[inx];
      }
    }
  }
  int sum = 0;
  for (int& num : golems) {
    sum += num;
  }
  std::cout << std::to_string(sum) << std::endl;
  return 0;
}
