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(' ')

  arr = []
  s.each_with_index do |char, i|
    arr.push(i) if char == t
  end

  arr.each do |i|
    index = i + 1
    if d == 'L' then
      cells[index - 1] += cells[index]
    else
      cells[index + 1] += cells[index]
    end
    cells[index] = 0
  end
end

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