import numpy as np

N, Q = [int(i) for i in input().split(" ")]
s = np.array(list(input()))
places = np.ones(N)
methods = []
for i in range(Q):
    method = [i for i in input().split(" ")]
    methods.append(method)
methods = np.array(methods)
# print(methods)
unique_s = np.unique(s)
char_place_dicts = {}
for char in unique_s:
    char_place_dicts[char] = np.where(s == char)

for i in range(Q):
    char = methods[i][0]
    direction = methods[i][1]
    if char not in unique_s:
        continue

    if direction == "R":
        int_direction = 1
    else:
        int_direction = -1

    index_ = char_place_dicts[char][0]
    # print(index_)
    for place in index_:
        # print(place + int_direction)
        if place + int_direction != -1 and place + int_direction != N:
            places[place + int_direction] += places[place]
        places[place] = 0
    
print(np.sum(places))
