n, q = gets.split.map(&:to_i)
c_idx = {}
idx_count = []
gets.chomp.each_char.with_index do |c, idx|
  c_idx[c] ||= []
  c_idx[c] << idx
  idx_count << 1
end

q.times.each do
  t, d = gets.chomp.split

  targets = c_idx[t]
  next unless targets
  case d
  when 'L'
    targets.each do |i|
      idx_count[i - 1] += idx_count[i] unless i == 0
      idx_count[i] = 0
    end
  when 'R'
    targets.each do |i|
      idx_count[i + 1] += idx_count[i] unless i == n - 1
      idx_count[i] = 0
    end
  end
end

puts idx_count.inject(:+)
