N, Q = map(int, input().split())
string = input()

count_gorem = [1]*N
total_gorem = N

for i in range(Q):
    select, operation = map(str, input().split())
    for r in range(N):
        if (r == 0 or r == N-1) and string[r] == select:
            if operation == 'L':
                if r == 0:
                    total_gorem  -= count_gorem[r]
                else:
                    count_gorem[r-1] += count_gorem[r]
                count_gorem[r] = 0
            elif operation == 'R':
                if r == N-1:
                    total_gorem -= count_gorem[r]
                else:
                    count_gorem[r+1] += count_gorem[r]
                count_gorem[r] = 0
        elif string[r] == select:
            if operation == 'L':
                count_gorem[r-1] += count_gorem[r]
                count_gorem[r] = 0
            elif operation == 'R':
                count_gorem[r+1] += count_gorem[r]
                count_gorem[r] = 0
print(total_gorem)
            
