N, Q = gets.split(" ").map(&:to_i)
s = gets.chomp
t = []
d = []
Q.times do
    _t, _d = gets.split(" ")
    t << _t
    d << _d
end

robots = Array.new(N + 2, 1)
robots[0] = 0
robots[N+1] = 0
map = Hash.new { |h, k| h[k] = [] }
s.each_char.with_index do |ch, ix|
    map[ch] << ix + 1
end

# p d
# p map
# p robots
d.each_with_index do |dir, ix|
    # p [d[ix], t[ix]]
    if dir == 'L'
        map[t[ix]].each do |ix2|
            robots[ix2 - 1] += robots[ix2]
            robots[ix2] = 0
        end
    elsif dir == 'R'
        map[t[ix]].reverse_each do |ix2|
            robots[ix2 + 1] += robots[ix2]
            robots[ix2] = 0
        end
    # else
    #     raise "Unknown dir #{dir}"
    end
    # p robots
    # puts
end

# puts N , robots[0] , robots[N+1]
puts N - robots[0] - robots[N+1]
