N, Q = map(int, input().split())
s = input()
td_list = [input() for _ in range(Q)]

gorem_list = [1 for ones in range(N)]
for qq in range(Q):
    for nn in range(N):
        if s[nn] == td_list[qq][0]:
            if td_list[qq][2] == 'L' and nn == 0 and gorem_list[nn] >= 0:
                gorem_list[0] -= 1
            if td_list[qq][2] == 'L' and nn != 0 and gorem_list[nn] >= 0:
                gorem_list[nn] -= 1
                gorem_list[nn-1] += 1

            if td_list[qq][2] == 'R' and nn == N and gorem_list[nn] >= 0:
                gorem_list[N-1] -= 1
            if td_list[qq][2] == 'R' and nn != N and gorem_list[nn] >= 0:
                gorem_list[nn] -= 1
                gorem_list[nn+1] += 1
print(sum(gorem_list))