N, Q = tuple(map(int, input().split()))

alllines = [[] for i in range(Q+1)]
s = input()
for i in range(Q+1):
    for j in range(N):
        alllines[i].append([s[j],0])
for i in range(N):
    alllines[0][i][1] = 1
for i in range(Q+1):
    alllines[i].insert(0,['X',0])
    alllines[i].append(['X',0])

allorders = [() for i in range(Q)]
for i in range(Q):
    allorders[i] = tuple(input().split())
    
for i in range(Q):
    alllines[i+1][0][1] += alllines[i][0][1]
    alllines[i+1][N+1][1] += alllines[i][N+1][1]
    for j in range(1,N+1):
        if alllines[i][j][0] == allorders[i][0]:
            if allorders[i][1] == 'L':
                alllines[i+1][j-1][1] += alllines[i][j][1]
            elif allorders[i][1] == 'R':
                alllines[i+1][j+1][1] += alllines[i][j][1]
        else:
            alllines[i+1][j][1] += alllines[i][j][1]

print(N-alllines[Q][0][1]-alllines[Q][N+1][1])