N,Q =  input().rstrip().split()
N = int(N)
Q = int(Q)
cells = list(input())

golems = [1 for i in range(N)]
alphabetlist = list('ABCDEFGHIJKLMNOPQRSTUVWXYZ')
golem_memo = {}
for i in alphabetlist:
    golem_memo[i] = []
for i in range(N):
    golem_memo[cells[i]].append(i)

#print(golem_memo)

for i in range(Q):
    letter, direction = input().rstrip().split()
    if direction == 'L':
        for point in golem_memo[letter]:
            if golems[point] > 0:
                if point != 0:
                    golems[point-1] += golems[point]
                golems[point] = 0
    elif direction == 'R':
        for point in golem_memo[letter]:
            if golems[point] > 0:
                if point != N-1:
                    golems[point+1] += golems[point]
                golems[point] = 0
             
print(sum(golems))