#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, q;
  cin >> n >> q;
  string str;
  cin >> str;
  vector<int> num(n + 2, 1);
  char name, dir, c;
  int sum = n;
  scanf("%c", &c);
  scanf("%c", &c);
  for (int i = 0; i < q; i++) {
    scanf("%c%c", &name, &dir);
    scanf("%c", &c);
    scanf("%c", &c);
    cout << name << endl;
    for (int j = 1; j < n + 1; j++) {
      if (str.at(j - 1) == name && dir == 'L') {
        num[j - 1] += num[j];
        num[j] = 0;
      } else if (str.at(j - 1) == name && dir == 'R') {
        num[j + 1] += num[j];
        num[j] = 0;
      }
    }
  }
  cout << sum + 2 - num[0] - num[n + 1] << endl;
}
