n, q = gets.chomp.split.map(&:to_i)
s = gets.chomp.split("")
t = Array.new(q, "")
d = Array.new(q, "")
cnt = 0
cntL = cntR = 0
for i in 0..(q-1)
  t[i], d[i] = gets.chomp.split
  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
for i in 0..(n-1)
  ch = s[i]
  id = i
  for j in 0..(q-1)
    if ch == t[j]
      if d[j] == "L"
        id -= 1
      elsif d[j] == "R"
        id += 1
      end
      if id < 0 || n - 1 < id
        break
      end
      ch = s[id]
    end
  end
  if 0 <= id && id < n
    cnt += 1
  end
end
puts cnt   