N, Q = gets.chomp.split(" ").map(&:to_i)
s = gets.chomp.split(//)
 
t = Array.new(Q)
d = Array.new(Q)
world = Array.new(N, "")

N.times { |i|
    world[i] = [s[i], 1]
}
 
Q.times { |i|
    t[i], d[i] = gets.chomp.split(" ")
    N.times { |j|
        if d[i] == "L"
            if world[j][0] == t[i]
                world[j-1][1] += world[j][1] if j > 0
                world[j][1] = 0
            end
        else
            if world[j][0] == t[i]
                world[j+1][1] += world[j][1] if j < N-1
                world[j][1] = 0
            end
        end
    }
}
 
total = 0
world.each { |i|
    total += i[1]
}
 
puts total