#include <bits/stdc++.h>
using namespace std;
using myui = uint64_t;
using myint = int64_t;
template <typename T>
T diff(const T& a, const T& b) {
  return a > b ? a - b : b - a;
}
int main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  {
    myui n, q;
    cin >> n >> q;
    string s;
    cin >> s;
    unordered_multimap<char, myui> m;
    for (myui i = 0; i < s.size(); i++) {
      m.insert(make_pair(s[i], i));
    }
    vector<myui> cells(n, 1);
    string t, d;
    for (myui i = 0; i < q; i++) {
      cin >> t >> d;
      auto idx = m.bucket(t[0]);
      vector<myui> buf = cells;
      switch (d[0]) {
        case 'L':
          for (auto it = m.cbegin(idx); it != m.cend(idx); it++) {
            const auto j = it->second;
            if (buf[j] != 0) {
              myui tmp = buf[j];
              cells[j] -= tmp;
              if (j != 0) {
                cells[j - 1] += tmp;
              }
            }
          }
          break;
        case 'R':
          for (auto it = m.cbegin(idx); it != m.cend(idx); it++) {
            const auto j = it->second;
            if (buf[j] != 0) {
              myui tmp = buf[j];
              cells[j] -= tmp;
              if (j != n - 1) {
                cells[j + 1] += tmp;
              }
            }
          }
          break;
      }
    }
    cout << accumulate(cells.cbegin(), cells.cend(), myui()) << endl;
  }
  return 0;
}
