N, Q = map(int, input().split(" "))     # マス数、呪文回数
s = list(input())   # マス文字
g_list = []
for i in range(len(s)):
    g_list.append([s[i], 1])


# 動かす
def move(d, str):
    i = g_list[str][1]
    g_list[str][1] = 0
    if d == "L":
        if str == 0:
            return
        g_list[str-1][1] += i
    else:
        if str == N-1:
            return
        g_list[str+1][1] += i
    # print(g_list)


for i in range(Q):
    t, d = list(input().split(" "))
    for str in range(N):
        if g_list[str][0] == t:
            move(d, str)
        else:
            continue

sum = 0
for l in g_list:
    sum+= l[1]
print(sum)