ar = gets.chomp.split(" ").map{|i|i = i.to_i}
n=ar[0]
q=ar[1]
s = gets.chomp!
h = {}
ii = 0
s.chars{|c|
    if h.include?(c) == true then
        h[c] << ii
    else 
        h[c] = [ii]
    end
    ii+=1
}
#pp h
order = {"L"=>-1,"R"=>1}
gorem = Array.new(n,1)
q.times do
    ar = gets.chomp.split(" ")
    t = ar[0]
    d = ar[1]
    if h.include?(t) then 
        h[t].each do|h_i|
            if gorem[h_i]!=0 then
                kari = gorem[h_i]
                gorem[h_i]=0
                j=h_i+order[d]
                if j>-1 && j<n then
                    gorem[j] +=kari
                end
            end
        end
    end
end
cc=0
gorem.each do|count|
    cc+=count
end

puts cc