N, Q = map(int, input().split())
s = list(input())
g = [1]*len(s)
t = ""
d = ""
sum = 0
for i in range(len(s)):
    t, d = map(str, input().split())
    if s[i] == t:
        if d == "L" and i != 0:
            g[i-1] += g[i]
            g[i] = 0
        elif d == "L" and i ==0:
            g[i] = 0
        elif d == "R" and i != len(s)-1:
            g[i+1] += g[i]
            g[i] = 0
        elif d == "R" and i == len(s)-1:
            g[i] = 0
print(sum(g))
        