# -*- coding: utf-8 -*-

N, Q = map(int, input().split())
s = list(input())
g_list = [1 for i in range(N)]

#td = [list(input().split()) for i in range(Q)]

for i in range(Q):
    t, d = input().split()
    
    if d == "L":
        if s[0] == t:
            g_list[0] = 0
        for i in range(1, N):
            if s[i] == t:
                g_list[i-1] += g_list[i]
                g_list[i] = 0
    if d == "R":
        if s[N-1] == t:
            g_list[N-1] = 0
        for i in range(N-1)[::-1]:
            if s[i] == t:
                g_list[i+1] += g_list[i]
                g_list[i] = 0

print(sum(g_list))