
from collections import defaultdict
N, Q = tuple(map(int, input().strip().split(' ')))
s = input()

commands = [
    tuple(input().strip().split(' '))
    for _ in range(Q)
]

char_index_dict = defaultdict(list)
for i, c in enumerate(s):
    char_index_dict[c].append(i)


deleted_set = set()
deletion_actors = set()
for t, c in commands[::-1]:
    for index in char_index_dict[t]:
        if c == 'L' and (index - 1) in deletion_actors:
            deletion_actors.add(index)
            deletion_actors.remove(index - 1)
            deleted_set.add(index)
        if c == 'R' and (index + 1) in deletion_actors:
            deletion_actors.add(index)
            deletion_actors.remove(index + 1)
            deleted_set.add(index)

    if s[0] == t and c == 'L':
        deletion_actors.add(0)
        deleted_set.add(0)
    if s[-1] == t and c == 'R':
        deletion_actors.add(N-1)
        deleted_set.add(N-1)

print(N - len(deleted_set))
