from collections import defaultdict

N, Q = map(int,input().split())
s = [_ for _ in input()]
td = [[_ for _ in input().split()] for _ in range(Q)]
GOL = [1 for _ in range(N)]

listS = defaultdict(list)
for i, word in enumerate(s):
    listS[word[0]].append(i)

for t, d in td:
    dictS = listS.get(t)
    if dictS == None:
        continue
    for idx in dictS:
        if (idx == 0 and d == "L") or (idx == N - 1 and d == "R"):
            pass
        else:
            if d == "L":
                GOL[idx - 1] += GOL[idx]
            else:
                GOL[idx + 1] += GOL[idx]

        GOL[idx] = 0

print(sum(GOL))