function Main(input) {
	//Start Definition
	input = input.split("\n");
	const input1 = input[0].split(" ");
	const n = parseInt(input1[0]);
	const q = parseInt(input1[1]);
	const s = input[1].split("");
	var line = [];
	var t = [];
	var d = [];
	var tmp = [];
	var dummy = [];
  	for (r=0;r<n;r++){
      dummy.push(1);
    }
	for (i=2;i<q+2;i++){
		line.push(input[i]);
	}
	for (j=0;j<q;j++){
		tmp = line[j].split(" ");
		t.push(tmp[0]);
		d.push(tmp[1]);
	}
	//End Definition


	//Start Execution
  console.log(t)
	for (k=0;k<q;k++){
         var points = [];
          var x = 0;
      for (g=0;g<n;g++) {
          x = s.indexOf(t[k],x);
			if (x=="-1"){
				break;
			}
            points.push(x);
          	x = x+1;
		}
		for (y=0;y<points.length;y++) {
				var point = points[y];
			if (point == 0 && d[k]=="L") {
              	dummy[point] = dummy[point] - 1;
			} else if(point == n-1 && d[k]=="R") {
				dummy[point] = dummy[point] - 1;
			} else {
				if (d[k]=="L"){
					dummy[point-1] = dummy[point-1] + 1;
					dummy[point] = dummy[point] - 1;
				} else if (d[k]=="R") {
					dummy[point+1] = dummy[point+1] + 1;
					dummy[point] = dummy[point] - 1;
				}
			}
		}
	}
  console.log(dummy)
	var sum = dummy.reduce(function(p, c) {
	 return p + c;
	});
	console.log(sum); 
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));