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

s = list(input())
S = [[] for i in range(N)]
for i in range(N):
    S[i].append(s[i])
S.insert(0,[''])
S.append([''])
# |S| = N+2

for q in range(Q):

    t, d = input().split()

    if d == 'L':
        for idx, s in enumerate(S):
            for si in s:
                if si == t:
                    S[idx-1].append(si)
                    S[idx].remove(si)

    elif d == 'R':
        for idx, s in enumerate(reversed(S)):
            for si in s:
                if si == t:
                    S[-(idx-1)-1].append(si)
                    S[-idx-1].remove(si)


    S[0].clear()
    S[-1].clear()
    #print(S)

res=0
for s in S:
    res += len(s)

print(res)