import sys
input = sys.stdin.readline

temp = input()
temp_spl = temp.split()
N = int(temp_spl[0])
Q = int(temp_spl[1])

temp = input()
s = temp
golem_place = list(range(N))
golem_num = N

# 呪文の数だけループする
for i in range(Q):
    temp = input()
    t, d = temp.split()
    if d == "L":
        adder = -1
    else:
        adder = 1
    # golemの移動
    # 削除フラグ建て
    delete_count = 0
    delete_list = []
    for j in 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
                delete_list.append(j)

    # ゴーレムを排除
    golem_num = golem_num - delete_count
    for j in range(delete_count):
        #後ろから消す
        golem_place.pop(delete_list[delete_count - j -1])

print(golem_num)