<?php
list($n, $q) = explode(" ", trim(fgets(STDIN)));
$str = trim(fgets(STDIN));

for($i = 0; $i < strlen($str); $i++){
    $char = $str[$i];
    $map[] = $char;
    $count[$char][$i] = 1;
}
for($i = 0; $i < $q; $i++){
    list($T, $D) =  explode(" ", trim(fgets(STDIN)));
    if($D == "R"){
        /*
        if(isset($count[$T])){
            $keyArray = array_keys($count[$T]);
            rsort($keyArray);
            foreach(@$keyArray as $pos){
                $amount = $count[$T][$pos];
                unset($count[$T][$pos]);
                if(isset($map[$pos + 1])){
                    @$count[$map[$pos + 1]][$pos + 1] += $amount;
                }
            }
        }
        */
    }else{
        if(isset($count[$T])){
            foreach($count[$T] as $pos => $amount){
                unset($count[$T][$pos]);
                if(isset($map[$pos - 1])){
                    @$count[$map[$pos - 1]][$pos - 1] += $amount;
                }
            }
        }
    }
}
$total = 0;
foreach($count as $c){
    $total += array_sum($c);
}
echo ($total);