N, Q = gets.split.map(&:to_i)
S = gets.chomp
s = S.chars
i = [*0...N]
query = Q.times.map { gets.chomp.split }

query.reverse_each do |t, d|
  if d == 'R' && s[-1] == t
    i.pop
    s.pop
  end

  if d == 'L' && s[0] == t
    i.shift
    s.shift
  end
end

ts = S.chars
lt = ts[0...i[0]]
rt = ts[(i[-1] + 1)..-1]

query.each do |t, d|
  if d == 'L'
    if rt[0] == t
      s.push(rt.shift)
    end

    if lt[0] == t
      lt.shift
    end
  end

  if d == 'R'
    if rt[-1] == t
      rt.pop
    end

    if lt[-1] == t
      s.push(lt.pop)
    end
  end
end

puts s.size
