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

hash = {}
hash.default = false

count = Array.new(n, 1)

q.times do |i|
  input = gets.chomp
  t = input[0]
  d = input[2]

  n.times do |j|
    if s[j] == t
      if d == 'L'
        count[j-1] += count[j] if j > 0
      else
        count[j+1] += count[j] if j < n-1
      end
      count[j] = 0
    end
  end
end

# p count
puts count.inject(:+)
