N, Q = [int(i) for i in input().split()]
s = input()
jumon = [[st for st in input().split()] for i in range(Q)]

gorem = [[s[i], i] for i in range(N)]

for i in range(Q):
    mv_str = jumon[i][0]
    mv_dir = jumon[i][1]
    for j in range(N):
        if gorem[j][0] == mv_str and mv_dir == 'L':
            gorem[j][1] -= 1
            if gorem[j][1] == -1:
                gorem[j][0] == 'stop'
            else:
                gorem[j][0] = s[gorem[j][1]]
        elif gorem[j][0] == mv_str and mv_dir == 'R':
            gorem[j][1] += 1
            if gorem[j][1] == N:
                gorem[j][0] == 'stop'
            else:
                gorem[j][0] = s[gorem[j][1]]

ct = 0
for i in range(N):
    if gorem[i][1] > -1 and gorem[i][1] < N:
        ct += 1

print(str(ct))