import lists, sequtils, strutils, algorithm, math, future, tables, sets, intsets

proc dump[T](x:T) =
    if false:
        echo x

var unko = stdin.readLine.split.map(parseInt)
var N = unko[0]
var Q = unko[1]
var xs = stdin.readLine
xs = "-" & xs & "-"
var ts = newSeq[char]()
var ds = newSeq[char]()
for i in 0..<Q:
    var unk = stdin.readLine.split
    var t = unk[0]
    var d = unk[1]
    ts.add t
    ds.add d
var ps: array[200002, bool]
ps[0] = true
ps[N+1] = true

for i in countdown(Q-1,0):
    var t = ts[i]
    var d = ds[i]
    if d == 'L':
        for j in countdown(N+1,1):
            if xs[j]==t:
                ps[j] = ps[j-1]
    else:
        for j in countup(0,N):
            if xs[j]==t:
                ps[j] = ps[j+1]

var re = 0
for j in countup(1,N):
    if not ps[j]:
        re += 1

dump ps[0..N+1]
echo re