function check(rrr)
    tmp = rrr
    res = "OK"
    posstr = string.sub(s, tmp, tmp)
    for i = 1, q do
        if(svtgt[i] == posstr) then
            if(svway[i] == "L") then
                if(tmp == 1) then
                    res = "LEFT"
                else
                    tmp = tmp - 1
                    posstr = string.sub(s, tmp, tmp)
                end
            else
                if(tmp == n) then
                    res = "RIGHT"
                else
                    tmp = tmp + 1
                    posstr = string.sub(s, tmp, tmp)
                end
            end
        end
        if(res ~= "OK") then break end
    end
    return res
end

n, q = io.read("*n", "*n", "*l")
s = io.read()
t = {}
num = {}
for i = 1, n do
    a = string.sub(s, i, i)
    if(t[a] == nil) then
        t[a] = {{}, {}}
    end
    table.insert(t[a][1], i)
    table.insert(t[a][2], 1, i)
    num[i] = 1
end
svtgt, svway = {}, {}
for i = 1, q do
    tgt, zz, way = io.read(1, 1, "*l")
    table.insert(svtgt, tgt)
    table.insert(svway, way)
end
leftmin = 1
leftmax = n
leftkill = 0
fres, nres = check(1), check(n)
if(nres == "LEFT") then
    leftkill = n
elseif(fres ~= "OK") then
    while(1 < leftmax -leftmin) do
        leftmid = math.floor((leftmin + leftmax) / 2)
        midret = check(leftmid)
        if(midret == "LEFT") then
            leftmin = leftmid
        else
            leftmax = leftmid
        end
    end
    leftkill = leftmin
end
rightmin = leftkill + 1
rightmax = n
rightkill = 0
if(check(rightmin) == "RIGHT") then
    rightkill = n - rightmin
elseif(nres ~= "OK") then
    while(1 < rightmax -rightmin) do
        rightmid = math.floor((rightmin + rightmax) / 2)
        midret = check(rightmid)
        if(midret == "RIGHT") then
            rightmax = rightmid
        else
            rightmin = rightmid
        end
    end
    rightkill = n + 1 - rightmax
end
print(n - leftkill - rightkill)
