from collections import defaultdict
N,Q = map(int,input().split())
s = input()
score=[1 for i in range(N+2)]
score[0]=0
score[N+1]=0
D = defaultdict(list)
for i in range(N):
    D[s[i]].append(i+1)
for i in range(Q):
    t,d = input().split()
    for i in D[t]:
        if score[i] > 0:
            if d == 'R':
                score[i+1] += score[i]
                score[i] = 0
            else:
                score[i-1] += score[i]
                score[i] = 0
print(N-score[0]-score[N+1])
