N,Q=gets.chomp.split(" ").map(&:to_i)
s_ary=gets.chomp.to_s.split('')
ary = Array.new(N, 1)
hash=Hash.new {|h,k| h[k] = {n: [], r:[]}}
s_ary.each_with_index do |s, i|
  hash[s][:n] << i
end
hash.keys.each do |k|
  hash[k][:r] = hash[k][:n].reverse
end
r_limit = ary.size - 1
Q.times do |i|
  a,b =gets.chomp.split(" ")
  if b == 'L'
    hash[a][:n].each do |elm|
      if elm == 0
        ary[0] = 0
      else
        ary[elm-1] += ary[elm]
        ary[elm] = 0
      end
    end
  else
    hash[a][:r].each do |elm|
      if elm == r_limit
        ary[-1] = 0
      else
        ary[elm+1] += ary[elm]
        ary[elm] = 0
      end
    end
  end
end

puts ary.inject(:+)