#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, q;
  scanf("%d%d", &n, &q);
  printf("%d%d\n", n, q);
  char s[n];
  scanf("%s", s);
  printf("%s\n", s);
  int p[n];
  for (int i = 0; i < n; i++) p[i] = 1;
  int c = n;
  char t, d;
  int move;
  for (int i = 0; i < q; i++) {
    int sca;
    sca = scanf(" %c %c", &t, &d);
    for (int j = 0; j < n; j++) {
      if (t == s[j]) {
        if (p[j] == 0) {
          move = 0;
        } else {
          move = p[j];
          p[j] = 0;
        }
        if (d == 'R') {
          if (j == n - 1) {
            c -= move;
          } else {
            p[j + 1] += move;
          }
        } else {
          if (j == 0) {
            c -= move;
          } else {
            p[j - 1] += move;
          }
        }
      }
    }
  }
  printf("%d\n", c);
  return 0;
}
