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
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, int]
for i in 0..<N:
    ps[i] = 1

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

for i in 0..<N:
    dump ps[i]
echo sum(ps)
