# encoding:utf-8
import copy
import numpy as np
import random
import bisect #bisect_left　これで二部探索の大小検索が行える

N,Q = map(int,input().split())
s = str(input())
T = []
D = []
for i in range(Q):
    t,d = map(str,input().split())
    T.append(t)
    D.append(d)

golem = [1 for i in range(N)]

positions = {}
for i in range(len(s)):
    if s[i] in positions.keys():
        tmp =  positions[s[i]]
        tmp.append(i)
        positions[s[i]] = tmp
    else:
        positions[s[i]] = [i]
# print(positions)
ans = N

for i in range(Q):
    if T[i] in positions.keys():
        move_poss = positions[T[i]]
        # print(golem)
        if D[i] == "R":
            for j in range(len(move_poss))[::-1]:
                if move_poss[j] == N-1:
                    ans -= golem[N-1]
                    golem[N-1] = 0
                else:
                    golem[move_poss[j]+1] += golem[move_poss[j]]
                    golem[move_poss[j]] = 0

        else:
            for j in range(len(move_poss)):
                if move_poss[j] == 0:
                    ans -= golem[0]
                    golem[0] = 0
                else:
                    golem[move_poss[j]-1] += golem[move_poss[j]]
                    golem[move_poss[j]] = 0

print(ans)
