def main
  m, n = gets.chomp.split.map(&:to_i)
  str = gets.chomp
  l = 0
  r = 0
  s = {}
  n.times do
    query = gets.chomp
    case query
    when 'R++' then r += 1
    when 'R--' then r -= 1
    when 'L++' then l += 1
    when 'L--' then l -= 1
    end
    s[str[l..r].hash] = 1
  end

  puts s.size
end

main