n, q = gets.chomp.split.map(&:to_i)
s = gets.chomp
g = []
n.times do |i|
  g[i] = 1
end
q.times do |i|
  t, d = gets.chomp.split
  if d == "L"
    if s[0] == t
      g[0] = 0
    end
    1.upto(n-1) do |j|
      if s[j] == t
        g[j-1] += g[j]
        g[j] = 0
      end
    end
  else
    if s[n-1] == t
      g[n-1] = 0
    end
    (n-2).downto(0) do |j|
      if s[j] == t
        g[j+1] += g[j]
        g[j] = 0
      end
    end
  end
end
puts g.inject(:+)