#include <bits/stdc++.h>
using namespace std;
const double pi = acos(-1.0);
using Edge = pair<int, long long>;
using Graph = vector<vector<Edge> >;
const long long mod = 1e9 + 7;
long long dx[4] = {1, 0, -1, 0};
long long dy[4] = {0, 1, 0, -1};
void printvll(vector<long long> v) {
  cout << "------------------------------------------------\n";
  for (int i = 0; i < v.size(); ++i) cout << v[i] << " ";
  cout << endl;
  cout << "------------------------------------------------\n";
}
void printvvll(vector<vector<long long> > v) {
  cout << "------------------------------------------------\n";
  for (int i = 0; i < v.size(); ++i) {
    for (int j = 0; j < v[i].size(); ++j) {
      cout << v[i][j] << " ";
    }
    cout << endl;
  }
  cout << "------------------------------------------------\n";
}
void prints(string s) {
  cout << "------------------------------------------------\n";
  for (int i = 0; i < s.size(); ++i) cout << s[i] << " ";
  cout << endl;
  cout << "------------------------------------------------\n";
}
void printvs(vector<string> s) {
  cout << "------------------------------------------------\n";
  for (int i = 0; i < s.size(); ++i) {
    for (int j = 0; j < s[i].size(); ++j) {
      cout << s[i][j] << " ";
    }
    cout << endl;
  }
  cout << "------------------------------------------------\n";
}
void Yes(bool x) {
  if (x)
    cout << "Yes\n";
  else
    cout << "No\n";
}
void YES(bool x) {
  if (x)
    cout << "YES\n";
  else
    cout << "NO\n";
}
void yes(bool x) {
  if (x)
    cout << "yes\n";
  else
    cout << "no\n";
}
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  long long d, n, r, l, k, ans = 0, ret = 1000000000000000000LL;
  bool flag = false, flag2 = false;
  string s, t;
  long long q;
  cin >> n >> q >> s;
  vector<long long> v(n, 1);
  vector<vector<long long> > count(26);
  for (int i = 0; i < n; ++i) count[s[i] - 'A'].push_back(i);
  for (int i = 0; i < q; ++i) {
    char a, b;
    cin >> a >> b;
    for (int j = 0; j < count[a - 'A'].size(); ++j) {
      long long tmp = v[count[a - 'A'][j]];
      v[count[a - 'A'][j]] = 0;
      if (b == 'L') {
        if (count[a - 'A'][j] == 0) {
          ans += tmp;
          v[count[a - 'A'][j]] = 0;
        } else
          v[count[a - 'A'][j] - 1] += tmp;
      } else {
        if (count[a - 'A'][j] == n - 1) {
          ans += tmp;
          v[count[a - 'A'][j]] = 0;
        } else
          v[count[a - 'A'][j] + 1] += tmp;
      }
    }
  }
  cout << n - ans << endl;
  return 0;
}
