use std::io::*;
use std::str::FromStr;

#[allow(unused_macros)]
macro_rules! scan {
  ($e:expr; $t:ty) => {
    $e.get::<$t>()
  };
  ($e:expr; $($t:ty), *) => {
    ($($e.get::<$t>(),)*)
  }
}

struct Scanner<R: BufRead> {
  reader: R,
  iter: std::vec::IntoIter<String>
}

#[allow(dead_code)]
impl<R: BufRead> Scanner<R> {
  fn new(reader: R) -> Scanner<R> {
    Scanner { reader: reader, iter: vec![String::new()].into_iter() }
  }
  fn new_line(&mut self) {
    let mut line = String::new();
    self.reader.read_line(&mut line).ok();
    self.iter = line.trim().split_whitespace().map(|s| s.to_string()).collect::<Vec<String>>().into_iter();
  }
  fn get<T: FromStr>(&mut self) -> T {
    self.iter.next().unwrap().parse().ok().unwrap()
  }
  fn get_as_vec<T: FromStr>(&mut self) -> Vec<T> {
    self.iter.clone().map(|v| v.parse().ok().unwrap()).collect()
  }
  fn get_line(&mut self) -> String {
    let mut line = String::new();
    self.reader.read_line(&mut line).ok();
    line.trim().to_string()
  }
}

fn main() {
  let cin = stdin();
  let cin = cin.lock();
  let mut sc = Scanner::new(cin);
  sc.new_line();
  let (n, q) = scan!(sc; usize, i32);
  let s = sc.get_line();
  let mut table: Vec<i32> = vec![1; n];
  let mut index: Vec<Vec<usize>> = Vec::with_capacity(26);
  for _ in 0..26 {
    index.push(Vec::with_capacity(n));
  }
  for (i, c) in s.chars().enumerate() {
    let idx = (c as u8 - 'A' as u8) as usize;
    index[idx].push(i);
  }
  for _ in 0..q {
    sc.new_line();
    let (t, d) = scan!(sc; char, char);
    let idx = (t as u8 - 'A' as u8) as usize;
    let indexes = &index[idx];
    match d {
      'L' => {
        for &i in indexes.iter() {
          if i != 0 {
            table[i - 1] += table[i];
          }
          table[i] = 0;
        }
      }
      'R' => {
        for &i in indexes.iter() {
          if i != n - 1 {
            table[i + 1] += table[i];
          }
          table[i] = 0;
        }
      }
      _ => ()
    }
  }
  println!("{}", table.iter().sum::<i32>());
}
