
#include <iostream>
#include<cstdlib>
#include<queue>
#include<set>
#include<vector>
#include<string>
#include<algorithm>
#include<stack>
#include<map>
#include<cstdio>
using namespace std;
#define rep(i,a) for(int i=0;i<a;i++)
#define irep(i,a)for(int i=1;i<=a;i++)
#define mp make_pair
#define pb push_back
#define P pair<int,int>
#define ll long long 
int n,q,ans;
string s;
char t,d;
int table[214514];
int hash[26][214514];
int pos[26];
int main(){
    cin>>n>>q>>s;
    rep(i,n)table[i]=1;

  rep(i,n){
    int tmp=s[i]-'A';
    hash[tmp][pos[tmp]]=i;
    pos[tmp]++;
  }

while(q--){
  cin>>t>>d;
  int tmp=t-'A';
    if(d=='R'){
      for(int i=pos[tmp]-1;i>=0;i--){
        //cout<<hash[tmp][i]<<endl;
        int cnt=table[hash[tmp][i]];
        table[hash[tmp][i]]=0;
        if(hash[tmp][i]==n-1)ans+=cnt;
        else table[hash[tmp][i]+1]+=cnt;
      }
    }
    if(d=='L'){
      for(int i=0;i<pos[tmp];i++){
            //    cout<<hash[tmp][i]<<endl;
        int cnt=table[hash[tmp][i]];
        table[hash[tmp][i]]=0;
        if(hash[tmp][i]==0)ans+=cnt;
        else table[hash[tmp][i]-1]+=cnt;
      }
      }
  }
cout<<n-ans<<endl;
	return 0;
}
