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

lc=0
count = Array.new(n, 1)

hash = {}
n.times do |j|
  hash[s[j]] = true
end


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

  next if hash[t].nil?
  hash = {}

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

# p count
puts count.inject(:+)
puts lc if debug
