nq = input()
s = input() # マス目の情報

n = int(nq.split(' ')[0]) # ゴーレムの数
board = [1 for i in range(n)]
q = int(nq.split(' ')[1]) # 試行回数

q_end = 0
for i in range(q):
    td = input()
    t = td.split(' ')[0]
    d = td.split(' ')[1]

    j = 0
    k = 0
    for i in range(n):
        if s[k] == t:
            if board[j] == 0:
                j += 1
                continue 
            if d == 'L':
                a = board[j] 
                board[j] = 0
                p = j - 1
                if p >= 0:
                    board[p] = board[p] + a
                else:
                    n = n -1
            if d == 'R':
                a = board[j] 
                board[j] = 0
                p = j + 1
                if p < n:
                    board[p] = board[p] + a
                else:
                    n = n -1
        j += 1
        k += 1

n = sum(board)
print('{}'.format(n))

