
N, Q = tuple(map(int, input().strip().split(' ')))
s = input()

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

deleted_set = set()
deletion_actors = []
for t, c in commands[::-1]:
    for i, actor_index in enumerate(deletion_actors):
        if c == 'L':
            if actor_index + 1 <= N - 1:
                if s[actor_index + 1] == t:
                    deletion_actors[i] = actor_index + 1
                    deleted_set.add(actor_index + 1)
        else:
            if actor_index - 1 >= 0:
                if s[actor_index - 1] == t:
                    deletion_actors[i] = actor_index - 1
                    deleted_set.add(actor_index - 1)

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

    deletion_actors = list(set(deletion_actors))

print(N - len(deleted_set))
