package main

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


type Scanner struct {
  sc *bufio.Scanner
  buf []byte
}

func NewScanner(r io.Reader) *Scanner {
  s := &Scanner{
    sc: bufio.NewScanner(r),
  }
  s.sc.Split(bufio.ScanWords)
  s.sc.Buffer(s.buf, bufio.MaxScanTokenSize)
  return s
}

func (s *Scanner) nextInt() int {
  if s.sc.Scan() {
    i, err := strconv.Atoi(s.sc.Text())
    if err != nil {
      panic(err)
    }
    return i
  }
  panic("failed to scan")
}

func (s *Scanner) nextString() string {
  if s.sc.Scan() {
    return s.sc.Text()
  }
  panic("failed to scan")
}


func solve(w io.Writer, r io.Reader) {
  sc := NewScanner(r)
  N := sc.nextInt()
  Q := sc.nextInt()
  s := sc.nextString()

  m := make(map[byte][]int)
  mc := make([]int, N)

  for i, v := range s {
    m[byte(v)] = append(m[byte(v)], i)
    mc[i] = 1
  }

  c := N
  for i := 0; i < Q; i++ {
    ts := sc.nextString()
    ds := sc.nextString()
    t, d := ts[0], ds[0]
    
    for _, k := range m[t] {
      if mc[k] == 0 {
        continue
      }
      var p int
      if d == 'L' {
        if k > 0 {
          p = k - 1
        } else {
          c, mc[k] = c - mc[k], 0
          if c == 0 {
            break
          }
          continue
        }
      } else {
        if k < N-1 {
          p = k + 1
        } else {
          c, mc[k] = c - mc[k], 0
          if c == 0 {
            break
          }
          continue
        }
      }
      mc[p], mc[k] = mc[p] + mc[k], 0
    }
  }
  fmt.Fprint(w, c)
}

func main() {
  solve(os.Stdout, os.Stdin)
}