#include <iostream>
#include <sstream>
#include <iomanip>
#include <cstring>
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
#include <functional>
#include <cmath>
#include <queue>
#include <stack>
#include <map>
#include <unordered_set>

#define repd(i,a,b) for (int i=(a);i<(b);i++)
#define rep(i,n) repd(i,0,n)
typedef long long ll;

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

using namespace std;

const ll BIG = 1000000007LL;

int inputValue(){
    int a;
    cin >> a;
    return a;
};

template<typename T>
void inputArray(T* p, int a){
    rep(i, a){
        cin >> p[i];
    }
};

template<typename T>
void inputVector(vector<T> * p, int a){
    rep(i, a){
        T input;
        cin >> input;
        p -> push_back(input);
    }
}

template <typename T>
void output(T a, int precision = 0) {
    if(precision > 0){
        cout << setprecision(precision)  << a << "\n";
    }
    else{
        cout << a << "\n";
    }
}

const int Max = 210000;
//map<unordered_set<pair<char, 
string s;
map<char, vector<int>> smap;
pair<char, char> td[Max];
int golems[Max];
int N, Q;

int main(int argc, const char * argv[]) {
    cin >> N >> Q >> s;
    rep(i, s.length()) {
        smap[s[i]].push_back(i);
        golems[i] = 1;
    }
    rep(i, Q) {
        char t;
        char d;
        cin >> t >> d;
        td[i] = make_pair(t, d);
    }

    rep(i, Q) {
        auto& pos = smap[td[i].first];
        int ofs = td[i].second == 'R' ? 1 : -1;
        if (ofs > 0) {
            for (auto& p = pos.end()-1 ; p >= pos.begin(); p--) {
                int next = *p + ofs;
                if (next >= 0 && next < N) {
                    golems[next] += golems[*p];
                }
                if (golems[*p] > 0) {
                    golems[*p] = 0;
                }
            }
        } else {
            for (auto& p = pos.begin() ; p < pos.end(); p++) {
                int next = *p + ofs;
                if (next >= 0 && next < N) {
                    golems[next] += golems[*p];
                }
                if (golems[*p] > 0) {
                    golems[*p] = 0;
                }
            }
        }
        
        // rep(j, N) {
        //     output(golems[j]);
        // }
        // output("=-----");
    }

    int ans = 0;
    rep(i, N) {
        ans += golems[i];
    }

    output(ans);

    return 0;
}