use std::collections::HashMap;

fn main() {
    let mut buf = String::new();
    std::io::stdin().read_line(&mut buf).unwrap();
    let mut iter = buf.split_whitespace();
    let n: usize = iter.next().unwrap().parse().unwrap();
    let q: usize = iter.next().unwrap().parse().unwrap();

    let mut buf = String::new();
    std::io::stdin().read_line(&mut buf).unwrap();
    let s = buf.trim().chars().collect::<Vec<char>>();

    let mut smap: HashMap<char, Vec<usize>> = HashMap::new();
    for (i, c) in s.iter().enumerate() {
        if smap.contains_key(c) {
            smap.get_mut(c).unwrap().push(i);
        }
        else {
            smap.insert(*c, vec![i]);
        }
    }

    let mut golem_alive = vec![1; n];

    let mut ans: usize = n;
    for _ in 0..q {
        let mut buf = String::new();
        std::io::stdin().read_line(&mut buf).unwrap();
        let mut iter = buf.chars();
        let t: char = iter.next().unwrap();
        let _: char = iter.next().unwrap();
        let d: char = iter.next().unwrap();

        // println!("t: {}", t);
        // println!("d: {}", d);

        if !smap.contains_key(&t) {
            continue;
        }

        for p in smap[&t].iter() {
            // println!("{:?}", golem_alive);
            // println!("v: {:?}", smap[&t]);

            if golem_alive[*p] == 0 {
                continue;
            }

            if (*p == 0 && d == 'L') || (*p == n-1 && d == 'R') {
                ans -= golem_alive[*p];
                golem_alive[*p] = 0;
                continue;
            }

            let new_p = if d == 'L' {*p-1} else {*p+1};
            // println!("p: {}", p);
            // println!("np: {}", new_p);
            // println!("ga[p]: {}", golem_alive[*p]);
            // println!("ga[np]: {}", golem_alive[new_p]);

            golem_alive[new_p] += golem_alive[*p];
            golem_alive[*p] = 0;
        }

        // println!("{:?}", golem_alive);
        // println!("");
    }

    println!("{}", ans);
}