# import sys
# def input():
#     return sys.stdin.readline()[:-1]


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

golem_count = [1] * N

golem_point = {}

for i, c in enumerate(list(S)):

    if c in golem_point:
        golem_point[c].append(i)
    else:
        golem_point[c] = [i]

for _ in range(Q):

    t, d = input().split()

    if t not in golem_point:
        continue

    targets = golem_point[t]

    for target in targets:

        move_count = golem_count[target]

        golem_count[target] -= move_count

        if d == 'L':
            if target == 0:
                pass
            else:
                golem_count[target - 1] += move_count
        else:
            if target == N - 1:
                pass
            else:
                golem_count[target + 1] += move_count

print(sum(golem_count))
