#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <cassert>
#include <string>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <functional>
#include <iostream>
#include <map>
#include <set>
#include <list>
#include <limits>
#include <numeric>
#include <utility>
#include <deque>
#include <valarray>
#include <unordered_set>
#include <unordered_map>
#include <regex>
#include <array>
#include <bitset>
#include <complex>
#include <tuple>

using namespace std;
using ll = long long;
const int INF = 1e9;
const int MOD = 1e9 + 7;

int main()
{
  int n, q;
  cin >> n >> q;
  string s;
  cin >> s;

  vector<int> order[26];
  for (int i = 0; i < n; ++i)
    order[s[i] - 'A'].push_back(i);
  int cnt = 0;
  int num[n] = {};
  for (int i = 0; i < n; ++i)
    num[i] = 1;
  for (int i = 0; i < q; ++i)
  {
    char S, T;
    cin >> S >> T;
    if (T == 'R')
    {
      for (int j = order[S - 'A'].size() - 1; j >= 0; --j)
      {
        int itr = order[S - 'A'][j];
        if (itr == n - 1)
        {
          cnt += num[itr];
        }
        else
        {
          num[itr + 1] += num[itr];
        }
        num[itr] = 0;
      }
    }
    else
    {
      for (int j = 0; j < order[S - 'A'].size(); ++j)
      {
        int itr = order[S - 'A'][j];
        if (itr == 0)
        {
          cnt += num[itr];
        }
        else
        {
          num[itr - 1] += num[itr];
        }
        num[itr] = 0;
      }
    }
  }

  std::cout << n - cnt << endl;

  return 0;
}
