#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on 2019/3/31
Solved on 2019/3/
@author: shinjisu
"""


# ExaWizard C Wizard
#import math
#import numpy as np

def getInt(): return int(input())
def getIntList(): return [int(x) for x in input().split()]
# def getIntList(): return np.array(input().split(), dtype=np.longlong)
def getIntLines(n): return [int(input()) for i in range(n)]
"""
def getIntLines(n):
    data = zeros(n)
    for i in range(n):
        data[i] = getInt()
    return data
"""
def getIntMat(n, m):  # n行に渡って、1行にm個の整数
    #mat = zeros((n, m))
    mat = zeros2(n, m)
    for i in range(n):
        mat[i] = getIntList()
    return mat


def zeros(n): return [0]*n
# def zeros(n): return np.zeros(n, dtype=np.longlong)
def zeros2(n, m): return [zeros(m) for i in range(n)] # obsoleted zeros((n, m))で代替

INF = 10**18

class Debug():
    def __init__(self):
        self.debug = True
 
    def off(self):
        self.debug = False
 
    def dmp(self, x, cmt=''):
        if self.debug:
            if cmt != '':
                x = cmt + ': ' + str(x)
            else:
                x = str(x)
            print(x)
        return x

def prob():
    d = Debug()
    d.off()
    N, Q = getIntList()
    S = input()
    d.dmp((N,Q), 'N,Q')
    d.dmp((S), 'S')
    pos = {}
    golem = [1 for i in range(N)]
    for i in range(N):
        if S[i] not in pos:
            pos[S[i]] = [i]  # 位置
        else:
            pos[S[i]].append(i)
    d.dmp((pos), 'pos')
    count = 0
    d.dmp((golem), 'golem')
    for i in range(Q):
        frame, direction = [x for x in input().split()]
        #d.dmp((frame, direction), 'frame, direction')
        if frame in pos:
            if direction == 'R':
                for k in range(len(pos[frame])-1, -1, -1):
                    p = pos[frame][k]
                    if p == N-1:
                        count += golem[N-1]
                        # if not (len(pos[frame]) > 0 and pos[frame][k+1] == 1):
                        golem[p] = 0
                    else:
                        golem[p+1] += golem[p]
                        golem[p] = 0
            else:  # 'L'
                for k in range(len(pos[frame])):
                    p = pos[frame][k]
                    if p == 0:
                        count += golem[0]
                        golem[p] = 0
                    else:
                        golem[p-1] += golem[p]
                        golem[p] = 0
        #d.dmp((golem), 'golem')
    d.dmp((golem), 'golem')
    return N-count


ans = prob()
if ans is None:
    pass
elif type(ans) == tuple and ans[0] == 1:  # 1,ans
    for elm in ans[1]:
        print(elm)
else:
    print(ans)
