N, Q = map(int, input().split())
s = input()
queries = []
golems = [1 for _ in range(N)]
for _ in range(Q):
    t, d = input().split()
    queries.append((t, d))
lens = len(s)
# print(s)
for query in queries:
    # print(golems)
    # print(query)
    if query[1] == 'L':
        for i, char in enumerate(s):
            if char == query[0]:
                moving = golems[i]
                golems[i] = 0
                if i > 0:
                    golems[i-1] += moving
    else:
        for r, char in enumerate(s[::-1]):
            i = lens - 1 - r
            if char == query[0]:
                moving = golems[i]
                golems[i] = 0
                if i < lens - 1:
                    golems[i+1] += moving
num = sum(golems)
# print(golems)
print(num)
