N, Q = map(int, input().split())
S = input()

idx = {}

for i in range(len(S)):
    s = S[i]
    if s not in idx:
        idx[s] = [i]
    else:
        idx[S[i]] += [i]

arr = [1] * N

for n in range(Q):
    ch, direction = input().split()
    
    if ch in idx:
        if direction == 'L':
            for i in idx[ch]:
                if i > 0:
                    arr[i - 1] += arr[i]
                arr[i] = 0
        elif direction == 'R':
            for i in reversed(idx[ch]):
                if i < len(S) - 1:
                    arr[i + 1] += arr[i]
                arr[i] = 0

print(sum(arr))