N, Q = gets.chomp.split(' ').map(&:to_i)
s = gets.chomp
s_chars = s.chars
t_index_table = {}
s_chars.each.with_index do |c, i|
  t_index_table[c] ||= []
  t_index_table[c].push(i)
end
t_count = Array.new(N) { 1 }
Q.times do
  t, d = gets.chomp.split(' ')
  index_list = t_index_table[t]
  next if index_list.nil?
  if d == 'L'
    index_list.each do |i|
      t_count[i - 1] += t_count[i] if i > 0
      t_count[i] = 0
    end
  else
    index_list.each do |i|
      t_count[i + 1] += t_count[i] if i < N - 1
      t_count[i] = 0
    end
  end
end
ans = t_count.reduce(&:+)
puts ans
