#include <bits/stdc++.h>
using namespace std;
const int INF = 1 << 30;
const long long LINF = 1LL << 60;
const long long MOD = 1e9 + 7;
template <class T>
bool chmax(T &a, const T &b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T>
bool chmin(T &a, const T &b) {
  if (b < a) {
    a = b;
    return 1;
  }
  return 0;
}
const int MX = 2 * 100000 + 7;
const int NAB = 30;
vector<int> v[NAB];
int dp[MX];
int main() {
  int n, q;
  cin >> n >> q;
  string s;
  cin >> s;
  for (int i = (0); i <= (n - 1); i++) {
    dp[i + 1] = 1;
    int num = int(s[i]) - int('A');
    v[num].push_back(i + 1);
  }
  long long ans = n;
  for (int i = (1); i <= (q); i++) {
    cout << i << "OK";
    char t, d;
    cin >> t >> d;
    int num = int(t) - int('A');
    int move;
    if (d == 'L')
      move = -1;
    else
      move = 1;
    vector<int> cur;
    for (auto &x : v[num]) {
      cur.push_back(dp[x]);
      dp[x] = 0;
    }
    for (int j = (0); j <= (v[num].size() - 1); j++) {
      int next = v[num][j] + move;
      if (next < 1 || next > n) {
        ans -= cur[j];
      } else {
        dp[next] += cur[j];
      }
    }
  }
  cout << ans << endl;
  return 0;
}
