from sys import stdin
import math
import itertools
import copy


def makeIntMatrix(lines):
    intMatrix = []
    for a in makeStringMatrix(lines):
        intMatrix.append([int(b) for b in a])
    return intMatrix
 
 
def makeStringMatrix(lines):
    stringMatrix = [line.split() for line in lines]
    return stringMatrix
 
 
def makeInt(line):
    return int(line.rstrip())
 
 
def makeMultiInteger(line):
    return [int(x) for x in line.rstrip().split()]


def make_map(string):
    _dict = {}
    for i, t in enumerate(string):
        if not t in _dict:
            _dict[t] = [i]
        else:
            _dict[t].append(i)
    return _dict


def move(array, com_dict, com, dirc):
    new_array = copy.deepcopy(array)
    #print(new_array)
    for k, v_list in com_dict.items():
        if k == com:
            for i in v_list:
                com_cnt = array[i]
                if com_cnt > 0:
                    #print(com_cnt)
                    #array[i][com] = 0
                    new_array[i] = 0
                    if dirc == 'L':
                        if i > 0:
                            new_array[i-1] += com_cnt 
                    if dirc == 'R':
                        if i < len(array)-1:
                            new_array[i+1] += com_cnt
        #print(com, dirc)
        #print(array)
        #print(new_array)
    return new_array 


def solve(input_string):
    N, Q = input_string[0].rstrip().split()
    com_dict = make_map(input_string[1].rstrip())
    com_dirc_matrix = makeStringMatrix(input_string[2:])
    g_array = [1 for i in range(int(N))]
    for com, dirc in com_dirc_matrix:
        #print(com, dirc)
        g_array = move(g_array, com_dict, com, dirc)
    _sum  = sum(g_array)
    return _sum


def main():
    input_lines = stdin.readlines()
    answer = solve(input_lines)
    print(answer)


if __name__ == '__main__':
    main()
