function Main(input) {
  var lines = input.split('\n');
  var N = parseInt(lines[0].split(' ')[0], 10);
  var Q = parseInt(lines[0].split(' ')[1], 10);
  var s = lines[1];

  var x = Array(N).fill(1);
  var pos = {};

  s.split('').forEach(function(c, i) {
    if (pos[c]) {
      pos[c].push(i);
    } else {
      pos[c] = [i];
    }
  });

  for (var i = 2; i < lines.length; ++i) {
    var t = lines[i].split(' ')[0];
    var d = lines[i].split(' ')[1];

    if (pos[t]) {
      var targets = d === 'L' ? pos[t] : pos[t].slice().reverse();

      targets.forEach(function(p) {
        if (d === 'L') {
          if (p) x[p - 1] += x[p];          
        } else {
          if (p < N - 1) x[p + 1] += x[p];
        }
        x[p] = 0;
      });
    }
  }

  console.log(x.reduce(function(prev, cur) { return prev + cur; }));
}

Main(require("fs").readFileSync("/dev/stdin", "utf8"));