import sys

N, Q = map(int, sys.stdin.readline().split())
S = sys.stdin.readline().strip()
ops = [l.split() for l in sys.stdin.readlines()]

C = [1] * len(S)
M = {}
for i, s in enumerate(S):
    if s not in M:
        M[s] = set()
    M[s].add(i)

for t, d in ops:
    shift = 1 if d == 'R' else -1
    reverse = True if shift == 1 else False
    tmp = M.get(t)
    if not tmp:
        continue
    for i in sorted(tmp, reverse=reverse):
        new_i = i + shift
        if new_i >= 0 and new_i < len(S):
            C[new_i] += C[i]
            M[S[new_i]].add(new_i)
        C[i] = 0
        tmp.remove(i)

print(sum(C))