N, Q = [int(i) for i in input().split()]
s = input()
s = [s[i] for i in range(N)]
jumon = [[st for st in input().split()] for i in range(Q)]

gorem = [i for i in range(N)]
for i in range(Q):
    mv_str = jumon[i][0]
    mv_dir = jumon[i][1]
    if mv_dir == 'L':
        gorem = [gorem[j]-1 if gorem[j] > -1 and gorem[j] < N and mv_str == s[gorem[j]] else gorem[j] for j in range(len(gorem))]
        gorem = [gorem[j] for j in range(len(gorem)) if gorem[j] > -1]
    else:
        gorem = [gorem[j]+1 if gorem[j] > -1 and gorem[j] < N and mv_str == s[gorem[j]] else gorem[j] for j in range(len(gorem))]
        gorem = [gorem[j] for j in range(len(gorem)) if gorem[j] < N]

# output

print(len(gorem))
