#include <bits/stdc++.h>
using namespace std;
int GCD(const int& a, const int& b) {
  const int& _a = max(a, b);
  const int& _b = min(a, b);
  if (_a % _b == 0) {
    return _b;
  } else {
    return GCD(_b, _a % _b);
  }
}
int LCM(const int& a, const int& b) {
  const int& _a = max(a, b);
  const int& _b = min(a, b);
  return (_a * _b) / (GCD(_a, _b));
}
int main() {
  int N, Q;
  cin >> N >> Q;
  string s;
  cin >> s;
  vector<char> t;
  vector<char> d;
  for (int i = 0; i < Q; i++) {
    char t_tmp, d_tmp;
    cin >> t_tmp >> d_tmp;
    t.push_back(t_tmp);
    d.push_back(d_tmp);
  }
  set<char> cnt_key;
  for (int i = 0; i < s.size(); i++) {
    cnt_key.insert(s[i]);
  }
  map<char, int> cnt;
  for (auto itr = cnt_key.begin(); itr != cnt_key.end(); itr++) {
    cnt[*itr] = 0;
  }
  for (auto itr = cnt_key.begin(); itr != cnt_key.end(); itr++) {
    char key = *itr;
    for (int i = 0; i < s.size(); i++) {
      if (s[i] == key) {
        cnt[key]++;
      }
    }
  }
  for (int i = 0; i < t.size(); i++) {
    if (s[i] == *cnt_key.begin() && d[i] == 'L') {
      cnt[s[i]] = 0;
    } else if (i == *cnt_key.end() && d[i] == 'R') {
      cnt[s[i]] = 0;
    } else if (d[i] == 'L') {
      cnt[s[i + 1]] += cnt[s[i]];
      cnt[s[i]] = 0;
    } else if (d[i] == 'R') {
      cnt[s[i - 1]] += cnt[s[i]];
      cnt[s[i]] = 0;
    }
  }
  int ans = 0;
  for (auto itr = cnt_key.begin(); itr != cnt_key.end(); itr++) {
    char key = *itr;
    ans += cnt[key];
  }
  cout << ans << endl;
  return 0;
}
