package main

import (
	"bufio"
	"fmt"
	"io"
	"os"
	"strconv"
)

var (
	readString func() string
	stdout     *bufio.Writer
)

func init() {
	readString = newReadString(os.Stdin)
	stdout = bufio.NewWriter(os.Stdout)
}

func newReadString(ior io.Reader) func() string {
	r := bufio.NewScanner(ior)
	r.Buffer(make([]byte, 1024), int(1e+11))
	r.Split(bufio.ScanWords)

	return func() string {
		if !r.Scan() {
			panic("Scan failed")
		}
		return r.Text()
	}
}

func readInt() int {
	return int(readInt64())
}

func readInt64() int64 {
	i, err := strconv.ParseInt(readString(), 0, 64)
	if err != nil {
		panic(err.Error())
	}
	return i
}

func readIntSlice(n int) []int {
	b := make([]int, n)
	for i := 0; i < n; i++ {
		b[i] = readInt()
	}
	return b
}

func readLengthAndSlice() (int, []int) {
	n := readInt()
	return n, readIntSlice(n)
}

func printf(f string, args ...interface{}) (int, error) {
	return fmt.Fprintf(stdout, f, args...)
}

func println(args ...interface{}) (int, error) {
	return fmt.Fprintln(stdout, args...)
}

func eprintln(args ...interface{}) (int, error) {
	return fmt.Fprintln(os.Stderr, args...)
}

// readString() string
// readInt() int
// readIntSlice(n int) []int
// readLengthAndSlice() []int

// -----------------------------------------------------------------------------

func main() {
	defer stdout.Flush()
	n := readInt()
	q := readInt()
	s := []byte(readString())
	a := make([]int, 26)
	t := make([]int, q)
	d := make([]int, q)

	for i := 0; i < q; i++ {
		t[i] = int([]byte(readString())[0] - 'A')
		ds := readString()
		if ds == "R" {
			d[i] = 1
		} else {
			d[i] = -1
		}
	}

	l := 0
	r := n - 1
	for i := q - 1; i >= 0; i-- {
		ti := t[i]
		di := d[i]

		a[ti] += di

		rc := int(s[r] - 'A')
		j := 0
		for a[rc] > j {
			r--
			j++
			rc = int(s[r] - 'A')
		}

		lc := int(s[l] - 'A')
		j = 0
		for a[lc] < j {
			l++
			j--
			lc = int(s[r] - 'A')
		}
	}

	if r < l {
		println(0)
	} else {
		println(r - l)
	}
}

// -----------------------------------------------------------------------------
