let mk_accessor s =
  let buf = Array.make 27 [] in
  for i = 0 to (String.length s) - 1 do
    let idx = (Char.code @@ String.get s i) - (Char.code 'A') in
    buf.(idx) <- (i)::buf.(idx)
  done;
  (fun a -> let idx = (Char.code a) - (Char.code 'A') in buf.(idx))

let cmd_l cells ls =
  let ls = List.rev ls in
  let rec inner = function
  | [] -> ()
  | l::ls when l = 0 -> cells.(l) <- 0; inner ls
  | l::ls -> cells.(l - 1) <- cells.(l - 1) + cells.(l); cells.(l) <- 0; inner ls
  in inner ls

let rec cmd_r cells n = function
    | [] -> ()
    | r::rs when r = (n-1) -> cells.(r) <- 0; cmd_r cells n rs
    | r::rs -> cells.(r + 1) <- cells.(r + 1) + cells.(r); cells.(r) <- 0; cmd_r cells n rs

let count cells n = 
  let ans = ref 0 in for i = 0 to (n-1) do ans := !ans + (cells.(i)) done; !ans

let _ =
  let n, q = Scanf.scanf "%d %d\n" (fun n q -> n, q) in
  let s = Scanf.scanf "%s\n" (fun s -> s) in
  let cells = Array.make n 1 in
  let accessor = mk_accessor s in
  for i = 0 to (q - 1) do
    let t, d = Scanf.scanf "%c %c\n" (fun t d -> t, d) in
    if d = 'L' then cmd_l cells (accessor t)
    else cmd_r cells n (accessor t)
  done;
  count cells n |> print_int
