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

dic = {}
for n in range(len(s)):
    if s[n] in dic:
        dic[s[n]].append(n)
    else:
        dic[s[n]] = [n]

go = [1] * N
Z = N

for q in range(Q):
    t, d = input().split()
    if t in dic:
        loc = dic[t]
        if d == 'L':
            for l in loc:
                if l == 0:
                    Z -= go[l]
                    go[l] = 0
                else:
                    go[l - 1] += go[l]
                    go[l] = 0
        else:
            for l in loc:
                if l == N - 1:
                    Z -= go[l]
                    go[l] = 0
                else:
                    go[l + 1] += go[l]
                    go[l] = 0

print(Z)