package main

import (
	"fmt"
)

var (
	n int
	q int
	s string
	t []byte
	d []byte
	g []int
)

func solve() {
	for i := 0; i < q; i++ {
		for j := 0; j < n; j++ {
			if s[j] == t[i] && g[j] > 0 {
				if d[i] == 'L'{
					move := g[j]; g[j] = 0
					if j > 0 {
						g[j-1] += move
					}
				}
				if d[i] == 'R' {
					move := g[j]; g[j] = 0
					if j < n - 1 {
						g[j+1] += move
					}
				}
			}
		}
	}

	sum := 0
	for i := 0; i < n; i++ {
		sum += g[i]
	}
	fmt.Println(sum)
}

func main() {
	fmt.Scan(&n)
	fmt.Scan(&q)
	fmt.Scan(&s)

	g = make([]int, n)
	for i := 0; i < n; i++ {
		g[i] = 1
	}

	t = make([]byte, q)
	d = make([]byte, q)

	for i := 0; i < q; i++ {
		tmp := ""
		fmt.Scan(&tmp)
		t[i] = tmp[0]
		fmt.Scan(&tmp)
		d[i] = tmp[0]
	}

	solve()
}
