package main

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

func main() {
	scanner := bufio.NewScanner(bufio.NewReader(os.Stdin))
	scanner.Split(bufio.ScanWords)

	scanner.Scan()
	n, _ := strconv.Atoi(scanner.Text())
	scanner.Scan()
	q, _ := strconv.Atoi(scanner.Text())
	scanner.Scan()
	s := scanner.Text()

	m := make([][]int, 26)
	for i := 0; i < n; i++ {
		j := s[i] - 'A'
		m[j] = append(m[j], i)
	}

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

	for i := 0; i < q; i++ {
		scanner.Scan()
		t := scanner.Text()[0] - 'A'
		scanner.Scan()
		d := scanner.Text()

		if d == "L" {
			for j := 0; j < len(m[t]); j++ {
				if m[t][j]-1 >= 0 {
					state[m[t][j]-1] += state[m[t][j]]
				}
				state[m[t][j]] = 0
			}
		} else {
			for j := len(m[t]) - 1; j >= 0; j-- {
				if m[t][j]+1 < n {
					state[m[t][j]+1] += state[m[t][j]]
				}
				state[m[t][j]] = 0
			}
		}
	}

	sum := 0
	for i := 0; i < n; i++ {
		sum += state[i]
	}

	fmt.Println(sum)
}
