#include <bits/stdc++.h>
using namespace std;
struct node2 {
  int x;
  char y;
  int z;
} xx[200030];
int n, m;
void cmp1(char v) {
  for (int i = 0; i < n; i++) {
    if (xx[i].y == v) {
      if (i == 0) {
        xx[i].x = 0;
        continue;
      }
      xx[i - 1].x += xx[i].x;
      xx[i].x = 0;
    }
  }
}
void cmp2(char w) {
  for (int i = n - 1; i >= 0; i--) {
    if (xx[i].y == w) {
      if (i == n - 1) {
        xx[i].x = 0;
        continue;
      }
      xx[i + 1].x += xx[i].x;
      xx[i].x = 0;
    }
  }
}
int main() {
  scanf("%d %d", &n, &m);
  for (int i = 0; i < n; i++) {
    cin >> xx[i].y;
    xx[i].x = 1;
    xx[i].z = 0;
  }
  char a, b;
  for (int i = 0; i < m; i++) {
    cin >> a >> b;
    if (b == 'L') {
      cmp1(a);
    } else if (b == 'R') {
      cmp2(a);
    }
    for (int i = 0; i < n; i++) {
      printf("%c:%d\n", xx[i].y, xx[i].x);
    }
  }
  int sum = 0;
  for (int i = 0; i < n; i++) {
    sum += xx[i].x;
  }
  printf("%d\n", sum);
  return 0;
}
