N, Q = gets.split.map(&:to_i)
S = gets.chomp
query = Q.times.map { gets.chomp.split }

field = S.chars

query.reverse_each do |t, d|
  if field.last == t && d == 'R'
    field.pop
  end

  if field.first == t && d == 'L'
    field.shift
  end
end

puts field.size
