function Main(input){
  var ary = [];
  for(var i=0;i<input.split("\n")[0].split(" ")[0];i++){
  	ary.push(1);
  }
  var str = input.split("\n")[1];
  for(var i=2;i<input.split("\n").length;i++){
  	var jumon = input.split("\n")[i].split(" ");
    if(jumon[1]=="L"){
    	for(var j=ary.length-1;j>=0;j--){
       		if(str[j]==jumon[0]){
            	if(j!=0){
                  ary[j-1]+=ary[j];
                }
             	ary[j]=0;
            }
        }
    }else{
        for(var j=0;j<ary.length;j++){
          if(str[j]==jumon[0]){
          	if(j!=ary.length-1){
              ary[j+1]+=ary[j];
            }
           	ary[j]=0;
          }
        }
    }
  }
  var golems = 0;
  for(var i of ary)golems+=i;
  console.log(golems);
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));