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

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

state = Array.new(N){1}
cells = STDIN.gets.chomp.split('')


Q.times do
  line = STDIN.gets.chomp.split(' ')
  # line[0] => address
  # line[1] => L or R
  cells.each_with_index do |c, idx|
    next if c != line[0] # skip wrong address

    if idx == 0 && line[1] == 'L'
      state[idx] = 0
    elsif idx == N-1 && line[1] == 'R'
      state[idx] = 0
    else
      case line[1]
      when 'L'
        state[idx-1] += state[idx]
        state[idx] = 0
      when 'R'
        state[idx+1] += state[idx]
        state[idx] = 0
      end
    end
  end
end

puts state.inject(:+)
