import numpy as np
n,q= map(int,input().split())
s = list(input())
td = [input().split() for _ in range(q)]
data = {i :[] for i in list(set(s))}
for j,i in enumerate(s):
  data[i].append(j+1)

ans = np.array([0]+[1]*n+[0])

for i,j in td:
  if i in s:
    temp = ans[data[i[0]]].copy()
    ans[data[i[0]]]=0
    if j=='L':
      ans[np.array(data[i[0]])-1]+=temp
    else:
      ans[np.array(data[i[0]])+1]+=temp
print(n-ans[0]-ans[-1])