#include<bits/stdc++.h>
using namespace std;
int main(){
    char dummy;
    int N,Q;
    scanf("%d%d",&N,&Q);
    scanf("%c",&dummy);
    char Field[N+2];
    scanf("%s",Field+1);
    Field[0]='0';
    Field[N+1]='0';
    int Golem[26][N]={0};
    int PlaceNum[26]={0};
    int GolemNum[N+2];
    GolemNum[0]=0;
    GolemNum[N+1]=0;
    for(int i=1; i<=N; i++){
        GolemNum[i]=1;
        Golem[Field[i]-'A'][PlaceNum[Field[i]-'A']]=i;
        PlaceNum[Field[i]-'A']++;
    }
    char Let,Dir;
    int Move;
    scanf("%c",&dummy);
    for(int i=1; i<=Q; i++){
        scanf("%c%c%c%c",&Let,&dummy,&Dir,&dummy);
        if(Dir=='L') Move=-1;
        else Move=1;
        for(int j=0;j<PlaceNum[Let-'A'];j++){
            GolemNum[Golem[Let-'A'][j]+Move] += GolemNum[ Golem[Let-'A'][j] ];
            GolemNum[Golem[Let-'A'][j]]=0;
        }
    }
    int answer;
    answer = N - GolemNum[0] - GolemNum[N+1];
    printf("%d",answer);
    return 0;
}