#include <bits/stdc++.h>
struct Spell {
  char t;
  char d;
};
int solve(const std::string& board, const std::vector<Spell>& spells) {
  const auto board_size = static_cast<int>(board.size());
  std::unordered_multimap<char, int> mark_to_indexes;
  for (int i = 0; i < board_size; ++i) {
    mark_to_indexes.emplace(board[i], i);
  }
  std::vector<int> golems(board.size(), 1);
  for (const auto& s : spells) {
    const auto index_delta = s.d == 'L' ? -1 : 1;
    std::vector<std::pair<int, int>> golem_deltas;
    const auto range = mark_to_indexes.equal_range(s.t);
    for (auto it = range.first; it != range.second; ++it) {
      int j = it->second + index_delta;
      if (j >= 0 && j < board_size) {
        golem_deltas.push_back({j, golems[it->second]});
      }
      golems[it->second] = 0;
    }
    for (const auto& index_and_count : golem_deltas) {
      golems[index_and_count.first] += index_and_count.second;
    }
  }
  return std::accumulate(golems.begin(), golems.end(), 0);
}
int main() {
  int n, q;
  std::string s;
  std::cin >> n >> q >> s;
  std::vector<Spell> spells(q);
  for (int i = 0; i < q; ++i) {
    std::cin >> spells[i].t >> spells[i].d;
  }
  std::cout << solve(s, spells) << std::endl;
}
