N, Q = list(map(int, input().split()))
s = input()
alp = {}
board = [0] + [1 for i in range(N)] + [0]

for i in range(len(s)):
    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 = -1
        else:
            n = 1
        for idx in idxs:
            board[idx+n] += board[idx]
            board[idx] = 0
    
print(N-board[0]-board[-1])