#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, q;
  string s;
  cin >> n >> q >> s;
  vector<pair<char, int>> v;
  v.push_back(pair<char, int>{'#', 0});
  for (auto&& c : s) {
    v.push_back(pair<char, int>{c, 1});
  }
  v.push_back(pair<char, int>{'#', 0});
  for (int i = 0; i < q; i++) {
    char t, d;
    cin >> t >> d;
    for (int j = 1; j < n + 1; j++) {
      if (v[j].first == t && d == 'L') {
        v[j - 1].second += v[j].second;
        v[j].second = 0;
      } else if (v[j].first == t && d == 'R') {
        v[j + 1].second += v[j].second;
        v[j].second = 0;
      }
    }
  }
  v.erase(v.begin());
  v.erase(v.end());
  int sum = 0;
  for (auto&& p : v) {
    sum += p.second;
  }
  cout << sum << "\n";
}
