import array as ar

def getInt(): return int(input())
def getIntList(): return [int(x) for x in input().split()]

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 = [[] for i in range(26)]  # 英字別の位置
    pos = [ar.array('i') for i in range(26)]  # 英字別の位置
    cell = [1 for i in range(N+2)]
    cell = ar.array('i', cell)
    cell[0] = cell[N+1] = 0
    for i in range(N):
        pos[ord(S[i])-ord('A')].append(i+1)
    count = 0
    for i in range(Q):
        frame, direction = [x for x in input().split()]
        idx = ord(frame) - ord('A')
        posList = pos[idx]
        if direction == 'R':
            for k in range(len(posList)-1, -1, -1):
                p = posList[k]
                cell[p+1] += cell[p]
                cell[p] = 0
        else:  # 'L'
            for k in range(len(posList)):
                p = posList[k]
                cell[p-1] += cell[p]
                cell[p] = 0
    return N - cell[0] - cell[N+1]

ans = prob()
print(ans)
