#include <iostream>
#include <string>
#include <algorithm>
#include <unordered_map>
#include <vector>
using namespace std;

int main(){
  int num_golem,num_spell;
  cin>>num_golem>>num_spell;
  string golem;
  cin>>golem;
  unordered_map<char,vector<int>> m;
  for(int i=0;i<golem.size();++i){
    m[golem].push_back(i);
  }
  vector<int> count(golem.size(),1);
  for(int i=0;i<num_spell;++i){
    char type, operators;
    cin>>type>>operators;
    for(int j=0;j<m[type].size();++j){
      if(operators=='L'){
        if(m[type][j]!=0){
          m[type][j-1]+=m[type][j];
        }
        m[type][j]=0;
      } 
      if(operators=='R'){
        if(m[type][j]!=golem.size()-1){
          m[type][j+1]+=m[type][j];
        }
        m[type][j]=0;
      } 
    }
  }
  cout<<accumulate(count.begin(), count.end(), 0);
  return 0;
}
