import algorithm, hashes, macros, math, sequtils, sets, strutils, tables, times, unicode

macro unpack*(rhs: seq, cnt: static[int]): auto =
  let t = genSym(); result = quote do:(let `t` = `rhs`;())
  if NimMinor <= 17:
    for i in 0..<cnt: result[0][1].add(quote do:`t`[`i`])
  else:
    for i in 0..<cnt: result[1].add(quote do:`t`[`i`])

template input*(typ: typedesc, cnt: Natural = 0): untyped =
  let line = stdin.readLine.split(" ")
  when cnt == 0:
    when typ is int:    line.map(parseInt)
    elif typ is float:  line.map(parseFloat)
    elif typ is string: & line
  else:
    when typ is int:    line.map(parseInt).unpack(cnt)
    elif typ is float:  line.map(parseFloat).unpack(cnt)
    elif typ is string: line.unpack(cnt)

proc newSeq2[T](n1, n2: Natural): seq[seq[T]] = newSeqWith(n1, newSeq[T](n2))

# -------------------------------------------------- #

var (N, Q) = input(int, 2)
var S = input(string, 1); S = "#" & S & "#"

var T = newseq[string](Q + 1)
var D = newseq[string](Q + 1)
for i in 1..Q:
  (T[i], D[i]) = input(string, 2)

var chartoidx = newseq2[int](26, 0) # [文字] = {その文字の上に今いる駒のindex}
var idxtochar = newseq[int](N + 1) # [index] = そのindexの文字　これＳじゃないの　いや数字なので

for i in 1..N:
  var moji = ord(S[i]) - ord('A')
  chartoidx[moji].add(i)
  idxtochar[i] = moji

var hidari = 0
var migi = 0

for i in 1..Q:
  var (tt, d) = (T[i], D[i]) # 文字、方向
  var t = ord(tt[0]) - ord('A')
  if d == "L":
    var mm = chartoidx[t].len
    for i in countdown(mm - 1, 0):
      var newidx = idxtochar[i]- 1
      if newidx == 0:
        hidari += 1
      else:
        var newchar = idxtochar[newidx]
        chartoidx[newchar].add(newidx)
      chartoidx[t].delete(i, i)
  if d == "R":
    var mm = chartoidx[t].len
    for i in countdown(mm - 1, 0):
      var newidx = idxtochar[i] + 1
      if newidx == N + 1:
        migi += 1
      else:
        var newchar = idxtochar[newidx]
        chartoidx[newchar].add(newidx)
      chartoidx[t].delete(i, i)

echo N - (hidari + migi)