from collections import defaultdict

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

td = []
for i in range(Q):
    ti, di = input().split()
    td.append((ti, di))

golems_index = [1 for i in range(N)]

panel_index = defaultdict(set)
for i, name in enumerate(s):
    panel_index[name].add(i)


for t, d in td:
    for i in panel_index[t]:
        if d == 'L':
            if i == 0:
                golems_index[i] = 0
            else:
                golems_index[i - 1] += golems_index[i]
                golems_index[i] = 0
        elif d == 'R':
            if i == N - 1:
                golems_index[i] = 0
            else:
                golems_index[i + 1] += golems_index[i]
                golems_index[i] = 0

print(sum(golems_index))
