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 = {};

  for (var i = 0; i < s.length; ++i) {
    var c = s[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 = pos[t];

      if (d === 'L') {
        for (var j = 0; j < targets.length; ++j) {
          var p = targets[j];
        
          if (p) x[p - 1] += x[p];
          x[p] = 0;
        };
      } else {
        for (var j = targets.length - 1; j >= 0; --j) {
          var p = targets[j];
        
          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"));