N, Q = map(int, input().split())
s = list(input())
sSet = set(s) 

death = 0

for i in range(Q):
	t, d = input().split()

	if t in sSet:
		tmpS = s.copy()
		for index, golems in enumerate(tmpS):
			if t in golems:
				if d == 'L' and index == 0: 
					s[index] = ""
					death += len(golems) 
				elif d == 'L':
					s[index-1] = tmpS[index-1] + golems
					s[index] = ""
				elif d == 'R' and index == N - 1:
					s[index] = ""
					death += len(golems)
				else:
					s[index+1] = tmpS[index+1] + golems
					s[index] = ""

	print(s)


print(len(s) - death)
