n,q = gets.chomp.split(' ').map(&:to_i)
s = gets.chomp.split('')

addr = {}

s.each_with_index do |alpha,i|
  addr.has_key?(alpha) ? addr[alpha] << i : addr[alpha] = [i]
end

old = [1] * n
new = []

q.times do
  new = [0] * n
  t , d = gets.chomp.split(" ")
  next if addr[t].nil?
  n.times do |i|
    if addr[t].include?(i)
      if d == "L"
        new[i-1] += old[i] unless i-1 < 0
      else
        new[i+1] += old[i] unless i+1 >= n
      end
    else
      new[i] += old[i]
    end
  end

#  p s.join(", ")
#  p new
  old = new
end

puts new.inject(:+)