N,Q = (int(i) for i in input().split())
s = list(input())
list1 = [] #[[A,L]]
list2 = []
for i in range(Q):
  j = [str(h) for h in input().split()]
  list1.append(j)
for l in range(N):
  list2.append(1)
for k in range(Q):
  b = list1[k]
  if b[1] == "L":
    if b == [s[0],"L"]:
      if list2[0] == 0:
        pass
      else:
        list2[0] -= 1
    else:
      w = list2[s.index(b[0])]
      if w == 0:
        pass
      else:
        list2[s.index(b[0])] -= 1
        list2[s.index(b[0]) - 1] += 1
        
  if b[1] == "R":
    if b == [s[N-1],"R"]:
      if list2[N-1] == 0:
        pass
      else:
        list2[N-1] -= 1
    else:
      w = list2[s.index(b[0])]
      if w == 0:
        pass
      else:
        list2[s.index(b[0])] -= 1
        list2[s.index(b[0]) + 1] += 1
print(sum(list2))