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

gc = [1 for i in range(N)]
D = dict([(c, []) for c in 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'])
for i in range(N):
    if s[i] in D.keys():
        D[s[i]].append(i)
    else:
        D[s[i]] = [i]

for q in range(Q):
    t, d = input().split()
    if d == "L":
        for i in D[t]:
            if i > 0:
                gc[i-1] += gc[i]
            gc[i] = 0
    if d == 'R':
        for i in D[t][::-1]:
            if i < N-1:
                gc[i+1] += gc[i]
            gc[i] = 0

print(sum(gc))
