import sys

N, Q = map(int, sys.stdin.readline().split())

s = sys.stdin.readline()
golem_place = list(range(N))
golem_num = N

Q_list = []
for i in range(Q):
    t, d = sys.stdin.readline().split()
    Q_list.append([t, d])

# 呪文の数だけループする
for i in range(Q):
    t = Q_list[i][0]
    if Q_list[i][1] == "L":
        adder = -1
    else:
        adder = 1
    # golemの移動
    # 削除フラグ建て
    delete_count = 0
    for j in reversed(range(golem_num)):
        if s[golem_place[j]] == t:
            golem_place[j] = golem_place[j] + adder
            if golem_place[j] < 0 or golem_place[j] >= N:
                delete_count += 1
                golem_place.pop(j)

    # ゴーレムを排除
    golem_num = golem_num - delete_count

print(golem_num)