N, Q = map(int, input().split(' '))
S = [[txt, i+1] for i, txt in enumerate(input())]

cnt = N

for i in range(Q):
    inp = input().split(' ')
    t_q = inp[0]
    d_q = inp[1]

    shift = 0

    if d_q == 'L':
        shift = -1
    else:
        shift = +1

    for s in S:
        original_pos = s[1]
        if s[0] == t_q and not(s[1] < 1 or s[1] > N):
            s[1] += shift

            if original_pos != s[1] and (s[1] < 1 or s[1] > N):
                cnt -= 1

print(cnt)
