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

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


Q.times do
  line = gets.split

  if h.key?(line[0]) then
    temp = h[line[0]].split(",")
    else
        next
    end

    if line[1] == '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
