def move(order)
  move_to = -1
  move_to = 1 if order[1] == "R"
  $tile[order[0]].each do|item|
    $map[item+move_to] += $map[item] if item+move_to >= 0 && item+move_to < $n
    $map[item] = 0
  end
end

$n,q = gets.split(" ").map{|e| e.to_i}
s = gets.chomp
sa = s.split("")
$tile = {}
$map = []
sa.each_with_index do|item,idx|
  $tile[item] = [] if $tile[item].nil?
  $tile[item] << idx
  $map << 1
end
q.times do
  order = gets.split(" ")
  move(order) unless $tile[order[0]].nil?
end

puts $map.sum