#include <bits/stdc++.h>

int main() {
    int N, Q; std::cin >> N >> Q;
    std::string s; std::cin >> s;
    std::vector<int> fields(N, 1);
    std::map<char, std::vector<int>> map;
    for (int i = 0; i < N; ++i)map[s[i]].push_back(i);
    int ans = N;
    auto func = [&](auto begin, auto end, int num) {
        for (auto itr = begin; itr != end; ++itr) {
            int j = *itr + num;
            if (j < 0 || N <= j)ans -= fields[*itr];
            else fields[j] += fields[*itr];
            fields[*itr] = 0;
        }
    };
    for (int i = 0; i < Q; ++i) {
        char t, d; std::cin >> t >> d;
        switch (d) {
        case 'L':func(map[t].begin(), map[t].end(), -1); break;
        case 'R':func(map[t].rbegin(), map[t].rend(), 1); break;
        }
    }
    std::cout << ans << std::endl;
}