n, q = gets.chomp.split.map(&:to_i)
s = gets.chomp.split("")
t = Array.new(q, "")
d = Array.new(q, "")
cnt = 0
for i in 0..(q-1)
  t[i], d[i] = gets.chomp.split
end
cntL = cntR = 0
for i in 0..(q-1)
  if d[i] == "L"
    cntL += 1
  elsif d[i] == "R"
    cntR += 1
  end
end
if cntL + cntR < n
  s.slice!(cntL..(n-cntR-1))
  cnt += n - (cntL + cntR)
  n = cntL + cntR
end

mj = Hash.new(Array.new(0))
g = Array.new(n, 1)
for i in 0..(n-1)
  mj[s[i]].push(i)
end
for i in 0..(q-1)
  mj.each do |k, v|
    v.each do |id|
      if d[q] == "L"
        if id == 0
          g[id] = 0
        else
          g[id - 1] += g[id]
          g[id] = 0
        end
      else
        if id == n-1
          g[id] = 0
        else
          g[id + 1] += g[id]
          g[id] = 0
        end
      end
    end
  end
end
cnt += g.inject(:+)
puts cnt
  