#include <stdio.h>
#include <stdlib.h>
 
typedef char                SINT8;
typedef unsigned char       UINT8;
typedef short               SINT16;
typedef unsigned short      UINT16;
typedef int                 SINT32;
typedef unsigned int        UINT32;
typedef long long           SINT64;
typedef unsigned long long  UINT64;
 
#define MAX(a,b) ((a)>(b)?(a):(b))
#define MIN(a,b) ((a)<(b)?(a):(b))
#define ABS(a) ((a)>(0)?(a):-(a))
 
 
SINT32 main() {
    SINT32 n,q;
    scanf("%d%d",&n,&q);
 
 
    SINT32 kazu[200001] = {1};
    SINT8 s[200001] = {'0'};
 
    SINT8 t[200001] = {'0'};
    SINT8 d[200001] = {'0'};
 
    scanf("%s",s);
 
    for (SINT32 i = 0; i < q; i++) {
        scanf("%s%s",&t[i],&d[i]);
 
    }
 
    SINT32 count = 0;
    for (SINT32 i = q-1; i >= 0; i--) {
        if (d[i] == 'L') {
            if (s[count] == t[i]) {
                count++;
            }
        }
    }
    SINT32 buf = count;
    for (SINT32 i = 0; i < buf; i--) {
        if (d[i] == 'R') {
            if (s[count] == t[i]) {
                count--;
            }
        }
    }
 
    SINT32 count2 = 0;
    for (SINT32 i = q-1; i >= 0; i--) {
        if (d[i] == 'R') {
            if (s[n-1-count2] == t[i]) {
                count2++;
            }
        }
    }
    SINT32 buf = count2;
    for (SINT32 i = 0; i < buf; i--) {
        if (d[i] == 'L') {
            if (s[n-1-count2] == t[i]) {
                count--;
            }
        }
    }
 
 
 
 
 
    printf("%d\n",n-count-count2);
	return 0;
}