n, q = [int(x) for x in input().rstrip().split()]
s = list(input().rstrip())
g = [1] * len(s)
l = [[i for i in input().split()] for i in range(q)]

for x in l:
    for i in range(len(s)):
        if s[i] == x[0]:
            if g[i] > 0:
                temp = g[i]
                g[i] -= temp
                if x[1] == "L" and i > 0:
                    g[i-1] += temp
                elif x[1] == "R" and i < len(s)-1:
                    g[i + 1] += temp

r = 0
for i in g:
    r += i
print(r)
