n,q = gets.split.map(&:to_i)
s = gets.chomp.split('')
td = []
q.times do
  td.push gets.chomp.split
end
hc = Hash.new([])
g = Array.new(n).map { |e| 1 }
0.upto(n-1) do |i|
  hc[s[i]] += [i]
end
td.each do |e|
  c = e.first
  d = e.last
  dir = 0
  if d == 'L'
    dir = (-1)
  else
    dir = 1
  end
  hc[c].each do |p|
    b = g[p]
    np = p + dir
    if np >= 0 && np <= n - 1
      g[np] += b
    end
    g[p] -= b
  end
end
puts g.reduce(:+)
