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]

    for ii, jj in enumerate(initial):
        if F in jj:
            if S == 'R':
                if ii < N:
                    initial[ii+1] += initial[ii]
                    initial[ii] = ''
                else:
                    initial[ii] = ''

            elif S == 'L':
                if ii > 0:
                    initial[ii-1] += initial[ii]
                    initial[ii] = ''
                else:
                    initial[ii] = ''
res = len("".join(initial))
sys.stdout.write(str(res))
  
  
  

