N, Q = map(int, input().split())
s = input()
T = [0 for i in range(Q)]
D = [0 for i in range(Q)]
for i in range(Q):
    T[i], D[i] = input().split()
for i in range(Q):
    if T[i] == 'A':
        T[i] = 0
    elif T[i] == 'B':
        T[i] = 1
    elif T[i] == 'C':
        T[i] = 2
    elif T[i] == 'D':
        T[i] = 3
    elif T[i] == 'E':
        T[i] = 4
    elif T[i] == 'F':
        T[i] = 5
    elif T[i] == 'G':
        T[i] = 6
    elif T[i] == 'H':
        T[i] = 7
    elif T[i] == 'I':
        T[i] = 8
    elif T[i] == 'J':
        T[i] = 9
    elif T[i] == 'K':
        T[i] = 10
    elif T[i] == 'L':
        T[i] = 11
    elif T[i] == 'M':
        T[i] = 12
    elif T[i] == 'N':
        T[i] = 13
    elif T[i] == 'O':
        T[i] = 14
    elif T[i] == 'P':
        T[i] = 15
    elif T[i] == 'Q':
        T[i] = 16
    elif T[i] == 'R':
        T[i] = 17
    elif T[i] == 'S':
        T[i] = 18
    elif T[i] == 'T':
        T[i] = 19
    elif T[i] == 'U':
        T[i] = 20
    elif T[i] == 'V':
        T[i] = 21
    elif T[i] == 'W':
        T[i] = 22
    elif T[i] == 'X':
        T[i] = 23
    elif T[i] == 'Y':
        T[i] = 24
    elif T[i] == 'Z':
        T[i] = 25
for i in range(Q):
    if D[i] == 'L':
        D[i] = 0
    elif D[i] == 'R':
        D[i] = 1
word_of_cell = [0] * N 
for i in range(1,N+1):
    w = s[i-1:i] 
    if w == 'A':
        word_of_cell[i-1] = 0
    elif w == 'B':
        word_of_cell[i-1] = 1
    elif w == 'C':
        word_of_cell[i-1] = 2
    elif w == 'D':
        word_of_cell[i-1] = 3
    elif w == 'E':
        word_of_cell[i-1] = 4
    elif w == 'F':
        word_of_cell[i-1] = 5
    elif w == 'G':
        word_of_cell[i-1] = 6
    elif w == 'H':
        word_of_cell[i-1] = 7
    elif w == 'I':
        word_of_cell[i-1] = 8
    elif w == 'J':
        word_of_cell[i-1] = 9
    elif w == 'K':
        word_of_cell[i-1] = 10
    elif w == 'L':
        word_of_cell[i-1] = 11
    elif w == 'M':
        word_of_cell[i-1] = 12
    elif w == 'N':
        word_of_cell[i-1] = 13
    elif w == 'O':
        word_of_cell[i-1] = 14
    elif w == 'P':
        word_of_cell[i-1] = 15
    elif w == 'Q':
        word_of_cell[i-1] = 16
    elif w == 'R':
        word_of_cell[i-1] = 17
    elif w == 'S':
        word_of_cell[i-1] = 18
    elif w == 'T':
        word_of_cell[i-1] = 19
    elif w == 'U':
        word_of_cell[i-1] = 20
    elif w == 'V':
        word_of_cell[i-1] = 21
    elif w == 'W':
        word_of_cell[i-1] = 22
    elif w == 'X':
        word_of_cell[i-1] = 23
    elif w == 'Y':
        word_of_cell[i-1] = 24
    elif w == 'Z':
        word_of_cell[i-1] = 25
g_leave = [[[0 for i in range(N+3)] for d in range(2)] for t in range(26)] 
g_enter = [[[0 for i in range(N+3)]  for d in range(2)] for t in range(26)]
for t in range(26):
    for d in range(2):
        for i in range(1,N+1): 
            if word_of_cell[i-1] == t and d == 0: 
                g_enter[t][d][0] += 1 
                g_enter[t][d][g_enter[t][d][0]] = i 
                g_leave[t][d][0] += 1 
                g_leave[t][d][g_leave[t][d][0]] = i+1 
            if word_of_cell[i-1] == t and d == 1: 
                g_enter[t][d][0] += 1 
                g_enter[t][d][g_enter[t][d][0]] = i+2 
                g_leave[t][d][0] += 1 
                g_leave[t][d][g_leave[t][d][0]] = i+1 
golem_count = [0]*(N+2) 
for i in range(1,N+1): 
    golem_count[i] = 1
print(golem_count)
import copy
for q in range(Q):
    previous_golem_count = copy.deepcopy(golem_count) 
    for i in range(1,g_enter[T[q]][D[q]][0]+1):
        if D[q] == 0: 
            golem_count[g_enter[T[q]][D[q]][i]-1] += previous_golem_count[g_enter[T[q]][D[q]][i]]
        if D[q] == 1: 
            golem_count[g_enter[T[q]][D[q]][i]-1] += previous_golem_count[g_enter[T[q]][D[q]][i]-2]
    for i in range(1,g_leave[T[q]][D[q]][0]+1): 
            print('leave:'+str(g_leave[T[q]][D[q]][i]))
            golem_count[g_leave[T[q]][D[q]][i]-1] -= previous_golem_count[g_leave[T[q]][D[q]][i]-1] 
    print(golem_count)
print(N-golem_count[0]-golem_count[N+1])
