import numpy as np
from collections import defaultdict
N, Q = list(map(int, input().split()))
dic = defaultdict(lambda: [])
s = input()
for n in range(N):
    dic[s[n]].append(n)
for k in dic:
    dic[k] = np.asarray(dic[k]).astype(np.int32)
g = np.ones((N + 2,)).astype(np.int32)
for _ in range(Q):
    t, d = input().split()
    direction = 1 if d == 'R' else -1
    if t not in list(dic.keys()):
        continue
    tmp = g[dic[t] + 1]
    g[dic[t] + 1] = 0
    g[dic[t] + 1 + direction] = g[dic[t] + 1 + direction] + tmp 
print(np.sum(g[1:-1]))
