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))
place_flag = [0]*N

# 呪文の数だけループする
for i in range(Q):
    temp = input()
    temp_spl = temp.split()
    t = temp_spl[0]
    d = temp_spl[1]
    if d == "L":
        adder = -1
    else:
        adder = 1
    # 呪文のかかった地点をマークする
    place_flag = [0] * N
    for j in range(N):
        if s[j] == t:
            place_flag[j] = 1
    # golemの移動
    for j in range(N):
        if golem_place[j] != 99999999:
            if place_flag[golem_place[j]] == 1:
                golem_place[j] = golem_place[j] + adder

    # ゴーレムを排除
    for j in range(N):
        if golem_place[j] < 0 or golem_place[j] >= N:
            golem_place[j] = 99999999
    #print(golem_place)

alive_count = 0
for i in range(N):
    if golem_place[i] < 99999999:
        alive_count = alive_count + 1
print(alive_count)