import sys
import numpy as np

sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))

N, Q = lr()
squares = np.zeros(N+2, np.bool)
squares[0] = 1; squares[N+1] = 1
S = np.array(list('-' + sr() + '-'))
TD = [sr().split() for _ in range(Q)]
for t, d in TD[::-1]:
    index = np.where(S==t)[0]
    if d == 'L':
        i = -1
    else:
        i = 1
    squares[index] = squares[index] | squares[index+i]

answer = N + 2 - np.count_nonzero(squares)
print(answer)
# 49
