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

data = {}
N.times do |i|
  ss = s[i]
  if data[ss].nil?
    data[ss] = []
  end

  data[ss] << i
end

rdata = Array.new(N, 1)

Q.times do
  input = gets.split
  next unless data[input[0]]
  if input[1] == 'L'
    data[input[0]].each do |n|
      if n === 0
        rdata[0] = 0
      else
        rdata[n - 1] += rdata[n]
        rdata[n] = 0
      end
    end
  else
    data[input[0]].reverse.each do |n|
      if n === N - 1
        rdata[N - 1] = 0
      else
        rdata[n + 1] += rdata[n]
        rdata[n] = 0
      end
    end
  end
end

sum = 0
rdata.each do |n|
  sum += n
end
puts sum