import sys
sys.setrecursionlimit(int(1e7))

def inpl(): return list(map(int, input().split()))
from bisect import bisect
from collections import defaultdict

N, Q = inpl()
S = [ord(s) - 65 for s in input()]

X = [[] for i in range(26)]
T = [[] for i in range(26)]

for i in range(Q):
    t, d = input().split()
    q = ord(t) - 65
    X[q].append(i)
    T[q].append(d == "R")

ranswer = set()

def dig(q, x):
    #print(q, x)
    global ranswer
    s = S[x]
    if X[s][0] == q:
        ranswer.add(x)

    if x > 0:
        s = S[x-1]
        i = bisect(X[s], q-1) - 1
        if i >= 0 and T[s][i] == True:
            dig(X[s][i], x-1)
    if x < N-1:
        s = S[x+1]
        i = bisect(X[s], q-1) - 1
        if i >= 0 and T[s][i] == False:
            dig(X[s][i], x+1)

for q, t in zip(X[S[0]], T[S[0]]):
    if t == False:
        dig(q, 0)
for q, t in zip(X[S[N-1]], T[S[N-1]]):
    if t == True:
        dig(q, N-1)

print(N - len(ranswer))