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

pub fn main() {
    let i = stdin();
    let mut o = Vec::new();
    run(i.lock(), &mut o);
    stdout().write_all(&o).unwrap();
}

fn run<R: BufRead, W: Write>(i: R, o: &mut W) {
    let mut i = CpReader::new(i);
    let (n, q) = i.read2::<usize, usize>();
    let gs_last = n + 1;

    let mut gs = vec![1; n + 2];
    let mut table = vec![Vec::new(); 26];

    fn to_idx(c: u8) -> usize {
        (c - b'A') as usize
    }

    {
        let s = i.read_line().as_bytes();
        gs[0] = 0;
        gs[gs_last] = 0;

        for i in 0..n {
            table[to_idx(s[i])].push(i + 1);
        }
    }
    for _ in 0..q {
        let (t, d) = i.read2::<char, char>();
        let it = to_idx(t as u8);
        if d == 'L' {
            for &ig in &table[it] {
                gs[ig - 1] += gs[ig];
                gs[ig] = 0;
            }
        } else {
            for &ig in table[it].iter().rev() {
                gs[ig + 1] += gs[ig];
                gs[ig] = 0;
            }
        }
    }
    let ans = n - gs[0] - gs[gs_last];
    writeln!(o, "{}", ans).unwrap();
}

mod utils {
    use super::*;

    pub struct CpReader<R: BufRead> {
        r: R,
        s: String,
    }

    macro_rules! fn_read {
        { $f:ident($($t:ident),*) } => {
            #[allow(dead_code)]
            pub fn $f<$($t: FromStr),*>(&mut self) -> ($($t),*) {
                let i = &mut self.read_line().split(' ');
                ($(read_next::<$t,_>(i)),*)
            }
        };
    }

    impl<R: BufRead> CpReader<R> {
        pub fn new(r: R) -> Self {
            CpReader {
                r: r,
                s: String::new(),
            }
        }
        pub fn read_line(&mut self) -> &str {
            self.s.clear();
            self.r.read_line(&mut self.s).unwrap();
            self.s.trim()
        }

        fn_read! { read2(T1, T2) }
        fn_read! { read3(T1, T2, T3) }
        fn_read! { read4(T1, T2, T3, T4) }
        fn_read! { read5(T1, T2, T3, T4, T5) }
    }
    fn read_next<'a, T: FromStr, I: Iterator<Item = &'a str>>(i: &mut I) -> T {
        i.next().unwrap().parse().ok().unwrap()
    }

}
