N, Q = map(int, input().split())  # 複数数値入力
str = list(input())  # 一文字ずつ格納
basyo = list(range(1, N + 1))

for i in range(Q):
    t, d = input().split()
    basyoList = [i for i, moji in enumerate(str) if moji == t]  # 動かす場所

    if d == "R":
        basyoList = reversed(basyoList)

    for j in basyoList:
        ugokasuList = [i for i, ba in enumerate(basyo) if ba == j+1]
        for k in ugokasuList:
            if basyo[k] != -1:
                if d == "L":
                    basyo[k] = basyo[k] - 1
                    if basyo[k] == 0:
                        basyo[k] = -1
                else:
                    basyo[k] = basyo[k] + 1
                    if basyo[k] == N+1:
                        basyo[k] = -1


print(len([1 for x in basyo if x != -1]))
