# -*- coding: utf-8 -*-
N, Q = [int(i) for i in input().split()]
S = list(input())
result = 0
M = []
for i in range(N):
    M.append(1)
for i in range(Q):
    t, d = input().split()
    copyS = S[:]
    j = 0
    flg = True
    while copyS:
        if t in copyS[:]:
            print(1)
            j += copyS.index(t)
            if j == 0 and d == 'L' or j == N-1 and d == 'R':
                M[j] = 0
            elif d == 'L':
                M[j-1] += M[j]
                M[j] = 0
            elif d == 'R':
                M[j+1] += M[j]
                M[j] = 0
            if j < N-1:
                copyS = copyS[j+1:]
            else :
                copyS = False
for i in M:
    result += i

print(result)
