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

h = Hash.new { |h, k| h[k] = [] }
s = gets.chomp.split('')
s.each.with_index { |c,i| h[c] << i }
m = Array.new(N, 1)

Q.times do
  t, d = gets.chomp.split

  mod1 = Array.new(N, 0)
  mod2 = Array.new(N, 0)
  h[t].each do |i|
    mod1[i] = m[i]
    mod2[i] = -m[i]
  end

  mod1 = case d.to_sym
        when :L then [*mod1, 0].slice(1..-1)
        when :R then [0, *mod1].slice(0..-2)
        end

  m = [m, mod1, mod2].transpose.map { |a, b, c| a + b + c }
end

puts m.reduce(0, &:+)

