n, q = gets.split(' ').map(&:to_i)
cells = Array.new(n + 2, 1)
cells[0] = 0
cells[n + 1] = 0
s = gets.split('')

(0...q).each do |_|
  t, d = gets.split(' ')
  s_dup = s.dup
  head_num = 0

  while true do
    i = s_dup.index(t)
    break if (i == nil)
    index = head_num + i + 1

    if d == 'L' then
      cells[index - 1] += cells[index]
    else
      cells[index + 1] += cells[index]
    end
    cells[index] = 0
    s_dup = s_dup.slice(i + 1, s.length - 1)
    head_num = index
  end
end

puts n - cells[0] - cells[n + 1]
