import sys

z = sys.stdin.readline().strip()

char_context = sys.stdin.readline().strip()

char_len, iter = int(z.split(" ")[0]), int(z.split(" ")[1])

initial = list(char_context)

N = len(initial) - 1

for item in range(iter):
    z = sys.stdin.readline().strip()
    F, S = z.split(" ")[0], z.split(" ")[1]
    ii = 0
    while(ii <= N):
        if F in initial[ii]:
            if S == 'L':
                if ii > 0:
                    initial[ii-1] += initial[ii]
                    initial[ii] = ''
                else:
                    initial[ii] = ''
        ii += 1
    ii = N
    while(ii >= 0):
        if F in initial[ii]:
            if S == 'R':
                if ii < N:
                    initial[ii + 1] += initial[ii]
                    initial[ii] = ''
                else:
                    initial[ii] = ''
        ii -= 1


res = len("".join(initial))
sys.stdout.write(str(res))





