N, Q = gets.split.map(&:to_i)
S = gets.chomp.chars
T = readlines.map(&:split)
G = Array(0...N)

T.each do |t,d|
  N.times do |i|
    gi = G[i]
    next if S[gi] != t
    next if gi < 0
    gi += d=='L' ? -1 : 1
    G[i] = gi==N ? -1 : gi
  end
end
puts N - G.count(-1)