N, Q = map(int,input().split())
s = input()

right = list()
left = list()
for i in range(0, Q):
    t, d = input().split()
    if d == 'L':
        left.append(t)
    elif d == 'R':
        right.append(t)

right_cnt = 0
rifht_str = s[::-1]
for i in reversed(right):
    if i == rifht_str[0]:
        right_cnt = right_cnt + 1
        rifht_str = rifht_str[1:]

left_cnt = 0
left_str = s
for i in reversed(left):
    if i == left_str[0]:
        left_cnt = left_cnt + 1
        left_str = left_str[1:]

print(len(s) - right_cnt - left_cnt)
