def getInt(): return int(input())
def getIntList(): return [int(x) for x in input().split()]
def zeros(n): return [0]*n

def prob():
    N, Q = getIntList()
    S = input()
    pos = [[] for i in range(26)]  # 英字別の位置
    cell = [1 for i in range(N+2)]
    cell[0] = cell[N+1] = 0
    for i in range(N):
        pos[ord(S[i])-ord('A')].append(i+1)
    for i in range(Q):
        frame, direction = [x for x in input().split()]
        idx = ord(frame) - ord('A')
        posList = pos[idx]
        if direction == 'R':
            for k in range(len(posList)-1, -1, -1):
                p = posList[k]
                cell[p+1] += cell[p]
                cell[p] = 0
        else:  # 'L'
            for k in range(len(posList)):
                p = posList[k]
                cell[p-1] += cell[p]
                cell[p] = 0
    return N - cell[0] - cell[N+1]

ans = prob()
print(ans)
