#include <iostream>
#include <vector>
using namespace std;

int main() {
  int n, q;
  string s;
  cin >> n >> q >> s;
  
  vector<int> strMap[100];
  int golems[n];
  for (int i = 0; i < n; i++) {
    strMap[(int) s[i]].push_back(i);
    golems[i] = 1;
  }
  
  for (int i = 0; i < q; i++) {
    char t, d;
    cin >> t >> d;
    
    if (d == 'L' && j > 0)
      for (int j : strMap[(int) t])
      	golems[j - 1] += golems[j];

    if (d == 'R' && j < n - 1)
      for (int j : strMap[(int) t])
      	golems[j + 1] += golems[j];

    for (int j : strMap[(int) t])
      golems[j] = 0;
  }
  
  int sum = 0;
  for (int i = 0; i < n; i++)
    sum += golems[i];
  
  cout << sum << endl;
  return 0;
}