package main

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

func main() {
  input := Input{bufio.NewReaderSize(os.Stdin,100)}
  n,q := input.NextInts()
  s := input.NextLine()
  x := make([][]int,26)
  y := make([]int,n+2)
  for i:=1;i<n+1;i++ {
    t := int([]rune(s[i-1:i])[0])-65
    x[t] = append(x[t],i)
    y[i] = 1
  }
  for i:=0;i<q;i++ {
    t,d := input.NextStrings()
    for _,j := range x[t] {
      y[j+d],y[j] = y[j+d]+y[j],0
    }
  }
  fmt.Println(n-y[0]-y[n+1])
}

type Input struct { reader *bufio.Reader }
func(i *Input) NextLine() string {
  var buffer []byte
  for {
    line,isPrefix,err := i.reader.ReadLine()
    if err != nil { panic(err) }
    buffer = append(buffer,line...)
    if !isPrefix { break }
  }
  return string(buffer)
}
func(i *Input) NextStrings() (int,int) {
  s := strings.Split(i.NextLine()," ")
  n := int([]rune(s[0])[0])-65
  m := 1
  if s[1] == "L" { m = -1 }
  return n,m
}
func(i *Input) NextInts() (int,int) {
  s := strings.Split(i.NextLine()," ")
  x,_ := strconv.Atoi(s[0])
  y,_ := strconv.Atoi(s[1])
  return x,y
}