
ar = gets.chomp.split(" ").map{|i|i = i.to_i}
n=ar[0]
q=ar[1]
s = gets.chomp!
t=[]
d=[]

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

puts cc