masu , num = input().split()
line = input()
char = []
LR = []
for i  in range(int(num)):
   a,b = input().split()
   char.append(a)
   LR.append(b)
golem = [1] * int(masu)

for i in range(int(num)):
   for j in range(int(masu)):
      if char[i] == line[j]:
         if golem[j] > 0:
            golem[j] -= 1
            if LR[i] == 'L':
               if j != 0 and j <= int(masu):
                  golem[j-1] +=1
            else:
               if j != (int(masu)-1) and j < 0:
                  golem[j+1] +=1
print(golem)

last = 0

for c in range(int(masu)):
   last += golem[c]

print(last)