import numpy as np

N, Q = list(map(int, input().split()))
s = input()
alp = {}
board = np.ones(N+2)
board[[0, -1]] = 0

for i in range(N):
    if s[i] not in alp:
        alp[s[i]] = [i+1]
    else:
        alp[s[i]].append(i+1)

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

    if t in alp:
        idxs = alp[t]
        if d == 'L':
            n = np.array(-1)
        else:
            n = np.array(1)

        board[idxs+n] += board[idxs]
        board[idxs] = 0

print(int(N-board[0]-board[-1]))