if __name__ == '__main__':
	N,Q = map(int, input().split())
	s = input()
	char_dict = {}
	nums = [1]*(N+2)
	nums[0] = 0
	nums[N+1] = 0
	for i in range(N):
		if(s[i] in char_dict.keys()):
			val = char_dict[s[i]]
			val.append(i)
			char_dict[s[i]] = val
		else :
			char_dict[s[i]] = [i]

	for _ in range(Q):
		t,d = input().split()
		if( t in char_dict.keys()):
			if(d=='L'):
				for i in char_dict[t]:
					nums[i] += nums[i+1]
					nums[i+1] = 0
			else:
				for i in sorted(char_dict[t]):
						nums[i+2] += nums[i+1]
						nums[i+1] = 0
	print(N - nums[0] - nums[N+1])