<?php
list($n,$q) = explode(" ",trim(fgets(STDIN)));
$s = str_split(trim(fgets(STDIN)));
$ans = $n;
//ゴーレム
for($i=0;$i<$n;$i++){
	$a[$i] = 1;
}

for($i=0;$i<$q;$i++){
	list($t,$d) = explode(" ",trim(fgets(STDIN)));
	if($d == 'L'){
		for($j=0;$j<$n;$j++){
			if($s[$j]==$t){
				$move=$a[$j];
				$a[$j]=0;
				if($j != '0' ){
					$a[$j-1] += $move;
				}else{
					$ans -=$move;
				}
			}
			
		}
	}else{
		for($j=0;$j<$n;$j++){
			if($s[$j]==$t){
				$move=$a[$j];
				$a[$j]=0;
				if($j != $n-1 ){
					$a[$j+1] +=$move;
				}else{
					$ans -=$move;
				}
			}
			
		}
		
	}
}

echo $ans;