package main

import "fmt"

func main() {
	var (
		n int
		q int
		s string
	)
	fmt.Scan(&n, &q, &s)

	golem := make([]int, n)
	for i := range golem {
		golem[i]++
	}

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

		tmp := 0
		for j := range s {
			if string(s[j]) == t {
				if d == "R" {
					if j == len(s)-1 {
						if tmp != 0 {
							golem[j] = tmp
							tmp = 0
							continue
						}
						golem[j] = 0
						continue
					}
					if tmp == 0 {
						golem[j+1] += golem[j]
						golem[j] = 0
					} else {
						golem[j+1] += golem[j] - tmp
						golem[j] = tmp
						tmp = 0
					}
					if string(s[j+1]) == t {
						tmp = golem[j]
					}
				} else {
					if j == 0 {
						golem[j] = 0
						continue
					}
					golem[j-1] += golem[j]
					golem[j] = 0
				}
			}
		}
	}

	golemCounter := 0
	for _, elem := range golem {
		golemCounter += elem
	}
	fmt.Println(golemCounter)
}
