N,Q = map(int,input().split())
s = list(input())
move = []
onehot = [1]*(N+2)
for i in range(Q):
    t,d = input().split()
    move.append([t,d])
key_index = {}
search = []

for i in range(Q):
    if move[i][0] not in search:
        key_index[move[i][0]] = [j for j,x in enumerate(s) if x == move[i][0] ]
        search.append(move[i][0])


for i in range(Q):
    if move[i][1] == "R":
        for j in key_index[move[i][0]]:
            onehot[j+2] += onehot[j+1]
            onehot[j+1] = 0
    else:
        for j in key_index[move[i][0]]:
            onehot[j] += onehot[j+1]
            onehot[j+1] = 0
print(sum(onehot)-onehot[0]-onehot[N+1])