N, Q = gets.split.map(&:to_i)
S = gets.chomp!
t = []
d = []
h = Hash.new


Q.times do
  line = gets.split

  t << line.shift
  d << line.shift
end

for i in 0..N - 1 do
    if !h.key?(S[i]) then
        h[S[i]] = (i+1).to_s
    else
        h[S[i]] = h[S[i]] << "," << (i+1).to_s
    end
end

list = Array.new(N+2, 1)
list[0] = 0
list[N+1] = 0

for i in 0..Q - 1 do
    if h.key?(t[i]) then
        temp = h[t[i]].split(",")
    else
        next
    end

    if d[i] == 'R' then
        temp.reverse_each do |w|
            index = w.to_i
            list[index + 1] = list[index + 1] + list[index]
            list[index] = 0
        end
    else
        temp.each do |w|
            index = w.to_i
            list[index - 1] = list[index - 1] + list[index]
            list[index] = 0
        end
    end
end
output = N - list[0] - list[N+1]

puts output
