function main(input) {
  var lines = input.split("\n");
  var N = Number(lines[0].split(" ")[0])
  var Q = Number(lines[0].split(" ")[1]);
  var str = lines[1];
  var table = [];
  var map = {};
  for(var i=0;i<=N+1;i++){
    if(i==0 || i==N+1){
      table[i]={count:0};
    }else{
      table[i]={count:1, i: i};
      if(!map[str[i-1]]) map[str[i-1]] = [];
      map[str[i-1]].push(table[i]);
    }
  }
  for(var j=2;j<Q+2;j++){
    var t = lines[j].split(" ")[0];
    var d = lines[j].split(" ")[1];
    var movet = map[t];
    if(!movet) continue;
    if(d=="R"){
      for(var i=movet.length-1;i>=0;i--){
        var ii = movet[i].i;
        var mvc = table[ii].count;
        table[ii+1].count+=mvc;
        table[ii].count=0;
      }
    }else{
      for(var i=0;i<movet.length;i++){
        var ii = movet[i].i;
        var mvc = table[ii].count;
        table[ii-1].count+=mvc;
        table[ii].count=0;
      }
    }
  }
  console.log(N-table[0].count-table[N+1].count);
}

main(require('fs').readFileSync('/dev/stdin', 'utf8'))
