#include <bits/stdc++.h>

using namespace std;
#define _for(i,j,N) for(int i = (j);i < (N);i++)
#define _rep(i,j,N) for(int i = (j);i <= (N);i++)
#define ALL(x) x.begin(),x.end()
#define LL long long

int N,Q;
const int maxn = 200005;
map<int,int> vi[256];
//int nums[maxn];

int get_int(){int x;scanf("%d",&x);return x;}
double get_double(){double x;scanf("%lf",&x);return x;}
long long get_long(){long long x;scanf("%lld",&x);return x;}
vector<char> vc;

void tests(){
    ;
}

int main()
{
    i//os::sync_with_stdio(false);
    scanf("%d %d",&N,&Q);getchar();
    _for(i,0,N){
        char ch = getchar();
        vi[ch][i] = 1;
        vc.push_back(ch);
    }
    getchar();


    //_for(i,0,N) nums[i] = 1;

    int k = 0;
    _for(i,0,Q){

        char ch = getchar();
        getchar();
        char instr = getchar();
        getchar();

        if(instr == 'L'){
            int num = ch;
            map<int,int> copys = vi[num];
            vi[num].clear();

            for(auto &a:copys){
                int pos = a.first;
                if(pos == 0){
                    k+=a.second;
                }
                else{
                    char ch2 = vc[pos-1];
                    vi[ch2][pos-1] += a.second;
                }
            }
        }
        if(instr == 'R'){
            //char ch = s[0];
            int num = ch;
            map<int,int> copys = vi[num];
            vi[num].clear();

            for(auto &a:copys){
                int pos = a.first;
                if(pos == N-1){
                    k+=a.second;
                }
                else{
                    char ch2 = vc[pos+1];
                    vi[ch2][pos+1] += a.second;
                }
            }
        }
    }

    printf("%d\n",N-k);

    return 0;
}
