N,Q = map(int,input().split())
s = [0]+list(input())+[0]
t = [0]*(Q)
d = [0]*(Q)
counter = [0]*(N+2)
for i in range(Q):
    t[i],d[i] = input().split()
for i in range(1,N+1):
    counter[i] = 1

for i in range(Q):
    for j in range(1,N+1):
        if (s[j] == t[i]):
            if d[i] == "R":
                counter[j+1] = counter[j+1] + counter[j]
            else:
                counter[j-1] = counter[j-1] + counter[j]
            counter[j] = 0
print(N-counter[0]-counter[N+1])