<?php

$input = explode(' ', trim(fgets(STDIN)));
$n = (int)$input[0];
$q = (int)$input[1];

$s = trim(fgets(STDIN));

$state = [0];
// $idx_num_to_s = [];
$idx_s_to_num = [];
for ($i=1; $i <= $n; $i++) { 
	$tmp = $s[$i-1];
	$state[$i] = 1;
	// $idx_num_to_s[$i] = $tmp;
	if (!isset($idx_s_to_num[$tmp])) {
		$idx_s_to_num[$tmp] = [$i];
	}else{
		$idx_s_to_num[$tmp][] = $i;
	}
}
$state[] = 0;

for ($j=0; $j < $q; $j++) { 
	$input = explode(' ', trim(fgets(STDIN)));
	$t = $input[0];
	$d = $input[1];
	if (!isset($idx_s_to_num[$t])) {
		continue;
	}
	$target_nums = $idx_s_to_num[$t];
	$n_len = count($target_nums);
	if ($d === 'L') {
		for ($i=0; $i < $n_len; $i++) { 
			$tmp_num = $target_nums[$i];
			$state[$tmp_num-1] += $state[$tmp_num];
			$state[$tmp_num] = 0;
		}
	}else{
		for ($i=$n_len; $i > 0; $i--) { 
			$tmp_num = $target_nums[$i - 1];
			$state[$tmp_num+1] += $state[$tmp_num];
			$state[$tmp_num] = 0;
		}
	}
	// echo implode(',', $state) . PHP_EOL;
}
// var_dump($state);
echo $n - $state[0] - $state[$n+1];