N, Q = map(int, input().split())
S = input()
G = []
T = []
count = N

for i in range(N):
    G.append(1)

for i in range(Q):
    T.append(input())

for i in range(Q):
    if Q - i < N / 2:
        for ii in range(Q - i):
            if T[i][0] == S[ii]:
                if T[i][2] == "L":
                    if ii != 0:
                        G[ii - 1] += G[ii]
                    else:
                        count -= G[ii]
                    G[ii] = 0
            
                else:
                    if ii != N - 1:
                        G[ii + 1] += G[ii]
                    else:
                        count -= G[ii]
                    G[ii] = 0
            
            if T[i][0] == S[N - (Q - i - ii)]:
                if T[i][2] == "L":
                    if N - (Q - i - ii) != 0:
                        G[N - (Q - i - ii) - 1] += G[N - (Q - i - ii)]
                    else:
                        count -= G[N - (Q - i - ii)]
                    G[N - (Q - i - ii)] = 0
            
                else:
                    if N - (Q - i - ii) != N - 1:
                        G[N - (Q - i - ii) + 1] += G[N - (Q - i - ii)]
                    else:
                        count -= G[N - (Q - i - ii)]
                    G[N - (Q - i - ii)] = 0
    else:
        for ii in range(N):
            if T[i][0] == S[ii]:
                if T[i][2] == "L":
                    if ii != 0:
                        G[ii - 1] += G[ii]
                    else:
                        count -= G[ii]
                    G[ii] = 0
            
                else:
                    if ii != N - 1:
                        G[ii + 1] += G[ii]
                    else:
                        count -= G[ii]
                    G[ii] = 0

print(count)