import numpy as np
n, q = map(int, input().split())
s = input()
dic = {}
g = np.ones(n).astype(int)
for i, c in enumerate(s):
    if c in dic.keys():
        dic[c].append(i)
    else:
        dic[c] = [i]

for i in range(q):
    t, d = input().split()
    sign = 0
    if d == 'L':
        sign = -1
    else:
        sign = 1
    try:
        for m in dic[t]:
            number = g[m]
            g[m] = 0
            if 0 <= m + sign < n:
                g[m + sign] += number
    except:
        continue
print(int(sum(g)))
