n, q = gets.chomp.split.map(&:to_i)
s = gets.chomp
s = "0#{s}0"
g = []
rule = {}
(n+2).times do |i|
  g[i] = 1
end
1.upto(n) do |i|
  rule[s[i]] = []
end
1.upto(n) do |i|
  rule[s[i]] << i
end
q.times do
  t, d = gets.chomp.split
  if d == "L" && rule[t] != nil
    rule[t].each do |i|
      g[i-1] += g[i]
      g[i] = 0
    end
  elsif d == "R" && rule[t] != nil
    rule[t].reverse_each do |i|
      g[i+1] += g[i]
      g[i] = 0
    end
  end
end
puts g[1..n].inject(:+)