import collections

def main():
	n, q = map(int, input().split())
	s = input()
	# 地点iにいるゴーレムの数
	golems = [1]*n
	# 呪文に該当する場所
	points = collections.defaultdict(list)

	for i in range(n):
		points[s[i]].append(i)

	total = n
	for _ in range(q):
		point, move = input().split()
		for pos in points[point]:
			current_golems = golems[pos]
			golems[pos] = 0
			if move == "L":
				if pos == 0:
					total -= current_golems
				else:
					golems[pos-1] += current_golems
			else:
				if pos == n-1:
					total -= current_golems
				else:
					golems[pos+1] += current_golems
	print(total)

if __name__ == '__main__':
    main()