#include <bits/stdc++.h>
using namespace std;
template <typename T>
T get() {
  T a;
  cin >> a;
  return a;
}
template <typename T>
void prv(vector<T> const& vec, string space) {
  for (auto const& e : vec) {
    cout << e << space;
  }
  cout << endl;
}
template <typename T>
void prvv(vector<vector<T>> const& vec, string space, string line) {
  for (auto const& list : vec) {
    for (auto const& e : list) {
      cout << e << space;
    }
    cout << line;
  }
}
signed main() {
  long long N = get<long long>(), Q = get<long long>();
  string word = get<string>();
  vector<vector<long long>> letters('Z' - 'A' + 1);
  vector<long long> squares(N, 1);
  vector<long long> buffer = squares;
  for (long long i = 0; i < word.size(); i++) {
    cout << word[i] << "\n";
    letters[word[i] - 'A'].push_back(i);
  }
  for (long long i = 0; i < Q; i++) {
    string a, b;
    cin >> a >> b;
    long long index = a[0] - 'A';
    bool left = (b[0] == 'L') ? true : false;
    if (left) {
      for (long long j = 0; j < letters[index].size(); j++) {
        long long tmp = letters[index][j];
        long long value = buffer[letters[index][j]];
        squares[letters[index][j]] -= value;
        if (letters[index][j] - 1 < 0) {
          N -= value;
        } else {
          squares[letters[index][j] - 1] += value;
        }
      }
    } else {
      for (long long j = 0; j < letters[index].size(); j++) {
        long long value = buffer[letters[index][j]];
        squares[letters[index][j]] -= value;
        if (letters[index][j] + 1 >= squares.size()) {
          N -= value;
        } else {
          squares[letters[index][j] + 1] += value;
        }
      }
    }
    buffer = squares;
  }
  cout << N << "\n";
  long long a;
  cin >> a;
  ;
}
