import string

N, Q = [int(x) for x in input().split(" ")]
s = list(input())
TD = [input().split(' ') for _ in range(Q)]

char_map = {k: list() for k in (list(string.ascii_uppercase))}
board = [1 for _ in range(N)]

for (i, c) in enumerate(s):
    char_map[c].append(i)


for t, d in TD:
    for i in char_map[t]:
        if d == 'R':
            if i != N - 1:
                board[i + 1] += board[i]
        else:
            if i != 0:
                board[i - 1] += board[i]
        board[i] = 0

print(sum(board))