package main

import (
  "fmt"
  "os"
  "io"
)

func solve(w io.Writer, r io.Reader) {
  var N, Q int
  var s string
  fmt.Fscan(r, &N, &Q, &s)

  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++ {
    var ts, ds string
    fmt.Fscan(r, &ts, &ds)
    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--
          continue
        }
      } else {
        if k < N-1 {
          p = k + 1
        } else {
          c--
          continue
        }
      }
      mc[p], mc[k] = mc[k], 0
    }
  }
  fmt.Fprint(w, c)
}

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