# -*- coding: utf-8 -*-

n, q = map(int, input().split())
s = input().strip()

e = n
m = {}
g = []
for i, c in enumerate(s):
    if c not in m:
        m[c] = []
    m[c].append(i)
    g.append(1)


for _ in range(q):
    t, d = input().split()
    if t not in m:
        continue
    move = -1 if d == "L" else 1
    for j in m[t][::-move]:
        if j + move < 0 or j + move >= n:
            e -= g[j]
        else:
            g[(j + move)] += g[j]
        g[j] = 0

print(e)
