require 'pp'

N,Q = readline.chomp.split.map(&:to_i)
s = readline.chomp

h = Hash.new {|_h,_k| _h[_k] = [] }
s.each_char.with_index {|c,i| h[c].push(i) }
h.each {|k,v| v.sort! }

nums = Array.new(N,1)

Q.times do |t|
  c,dir = readline.chomp.split
  if dir == 'L'
    h[c].each do |i|
      if i == 0
        nums[i] = 0
      else
        nums[i-1] += nums[i]
        nums[i] = 0
      end
    end
  else
    h[c].reverse_each do |i|
      if i == N-1
        nums[i] = 0
      else
        nums[i+1] += nums[i]
        nums[i] = 0
      end
    end
  end
end

puts nums.inject(:+)
