inputs  = STDIN.gets.chomp.split(' ').map(&:to_i)

N = inputs[0]
Q = inputs[1]

state = Array.new(N){1}
cells = Hash.new
STDIN.gets.chomp.split('').each_with_index do |c, idx|
  cells[c] = Array.new unless cells[c]
  cells[c] << idx
end

Q.times do
  line = STDIN.gets.chomp.split(' ')
  # line[0] => t: address
  # line[1] => d: L or R
  index = cells[line[0]]
  index&.each do |i|
    if i == 0 && line[1] == 'L'
      state[i] = 0
    elsif i == N-1 && line[1] == 'R'
      state[i] = 0
    else
      case line[1]
      when 'L'
        state[i-1] += state[i]
      when 'R'
        state[i+1] += state[i]
      end
      state[i] = 0
    end
  end
end

puts state.inject(:+)