#!/usr/bin/env ruby

(n, q) = gets.chomp.split(/ /).map(&:to_i)
s = gets.chomp.split(//)
spells = []
q.times do
  spell = gets.chomp.split(/ /)
  spells.push spell
end

ingolem = Array.new(n + 2, 1)
tiles = Hash.new
s.each_with_index do |s, i|
  if (tiles[s] == nil)
    tiles[s] = [i + 1]
  else
    tiles[s].push (i + 1)
  end
end

spells.each do |spell|
  chr = spell[0]
  mov = spell[1] == 'L' ? -1 : 1
  tiles[chr].each do |t|
    tmp = ingolem[t]
    ingolem[t] = 0
    ingolem[t + mov] += tmp
  end
end
ingolem.shift
ingolem.pop
result = 0
ingolem.each do |i|
  result += i
end
puts result
