n,q = gets.chomp.split.map(&:to_i)
s = gets.chomp
ar = Array.new(n){1}
uq = s.split("").uniq
set = {}
uq.each do |chr|
	set[chr] = []
end

s.split("").each_with_index do |chr,idx|
	set[chr] << idx
end

readlines.each do |item|
	temp = item.chomp.split
	if uq.include?(item[0])
		set[temp[0]].each do |idx|
			if temp[1] == "L"
				ar[idx - 1] += ar[idx] if (idx - 1) >= 0
			else 
				ar[idx + 1] += ar[idx] if (idx + 1) < n
			end
			ar[idx] = 0
		end
	end
	# puts ar.to_s
end

puts ar.inject(:+)