N, Q = map(int,input().split())
s = input()
S = [1] * N

for i in range(Q):
  t, d = map(str, input().split())
  if d == "L":
    if s[0] == t:
      S[0] = 0
    for j in range(0, N - 2):
      if s[j+1] == t:
        S[j] = S[j] + S[j+1]
        S[j+1] = 0
      print(S)
    if s[N-1] == t:
      S[N-1] = 0
 
  else:
    if s[N-1] == t:
      S[N-1] = 0
    for j in range(1, N)[::-1]:
      if s[j-1] == t:
        S[j] = S[j-1] + S[j]
        S[j-1] = 0
    if s[0] == t:
      S[0] = 0
print(sum(S))