package main

import "fmt"

func main() {
	var N, Q int
	var s string
	fmt.Scanln(&N, &Q)
	fmt.Scanln(&s)

	g := make([]int, N)
	for i := range g {
		g[i] = 1
	}

	index := make(map[byte][]int)

	for i := 0; i < Q; i++ {
		var t, d string
		fmt.Scanln(&t, &d)

		in, ok := index[t[0]]
		if !ok {
			in = make([]int, 0)
			for j := range s {
				if s[j] == t[0] {
					in = append(in, j)
				}
			}
			index[t[0]] = in
			fmt.Println(t, in)
		}

		if d == "L" {
			for _, j := range in {
				if j != 0 {
					g[j-1] += g[j]
				}
				g[j] = 0
			}
		} else {
			for jj := len(in) - 1; jj >= 0; jj-- {
				j := in[jj]
				if j < N-1 {
					g[j+1] += g[j]
				}
				g[j] = 0
			}
		}
	}

	live := 0
	for _, n := range g {
		live += n
	}
	fmt.Println(live)
}
