function myin(){return require("fs").readFileSync("/dev/stdin", "utf8").trim();}
function myout(t){console.log(t);}//standard output
//[no]param
//0:何もしない  1:数値へ変換  2:半角SPで分割  3:改行で分割  4:半角SPで分割し、数値配列へ
//5:改行で分割し、数値配列へ  6:1文字に分割  7:1文字に分割し、数値配列へ
function myconv(i,no){switch(no){case 0:return i;case 1:return parseInt(i);case 2:return i.split(" ");case 3:return i.split("\n");case 4:return i.split(" ").map((a)=>Number(a));case 5:return i.split("\n").map((a)=>Number(a));case 6:return i.split("");case 7:return i.split("").map((a)=>Number(a));}}

function Main(input) {
  input = myconv(input,3);
  var N = myconv(input[0],4)[0];
  var Q = myconv(input[0],4)[1];
  input.shift();
  var s = myconv(input[0],6);
  input.shift();
  //文字が何番目にあるかのリスト
  var indexList = {};
  var count = new Array(N).fill(1);
  for(var i = 0; i < N; i++){
    if(indexList[s[i]] == null){
       indexList[s[i]] = [i];
    }else{
      indexList[s[i]].push(i);
    }
  }
  for(var i = 0; i < Q; i++){
    var tmp = myconv(input[i],2);
    var t = tmp[0];
    var d = tmp[1];
    if(indexList[t] == null){
       continue;
    }
    var selectIndexes = indexList[t];
    if(d == "L"){
       for(var j = 0; j < selectIndexes.length; j++){
         var move = count[selectIndexes[j]];
         count[selectIndexes[j]] = 0;
         if(selectIndexes[j] != 0){
            count[selectIndexes[j]-1] += move;
         }
       }
    }else{
       for(var j = selectIndexes.length-1; j >= 0; j--){
         var move = count[selectIndexes[j]];
         count[selectIndexes[j]] = 0;
         if(selectIndexes[j] != N-1){
            count[selectIndexes[j]+1] += move;
         }
       }
    }
  }
  var output = 0;
  for(var i = 0; i < count.length; i++){
    output += count[i];
  }
  myout(output);
}

Main(myin());
