n players are going to play a rock-paper-scissors tournament. As you probably know, in a one-on-one match of rock-paper-scissors, two players choose their shapes independently. The outcome is then determined depending on the chosen shapes: "paper" beats "rock", "rock" beats "scissors", "scissors" beat "paper", and two equal shapes result in a draw.

At the start of the tournament all players will stand in a row, with their numbers increasing from 1 for the leftmost player, to n for the rightmost player. Each player has a pre-chosen shape that they will use in every game throughout the tournament. Here's how the tournament is conducted:

  * If there is only one player left, he is declared the champion.
  * Otherwise, two adjacent players in the row are chosen arbitrarily, and they play the next match. The losing player is eliminated from the tournament and leaves his place in the row (with his former neighbours becoming adjacent). If the game is a draw, the losing player is determined by a coin toss.



The organizers are informed about all players' favoured shapes. They wish to find out the total number of players who have a chance of becoming the tournament champion (that is, there is a suitable way to choose the order of the games and manipulate the coin tosses). However, some players are still optimizing their strategy, and can inform the organizers about their new shapes. Can you find the number of possible champions after each such request?

Input

The first line contains two integers n and q — the number of players and requests respectively (1 ≤ n ≤ 2 ⋅ 10^5, 0 ≤ q ≤ 2 ⋅ 10^5).

The second line contains a string of n characters. The i-th of these characters is "R", "P", or "S" if the player i was going to play "rock", "paper", or "scissors" before all requests respectively.

The following q lines describe the requests. The j-th of these lines contain an integer p_j and a character c_j meaning that the player p_j is going to use the shape described by the character c_j from this moment (1 ≤ p_j ≤ n).

Output

Print q + 1 integers r_0, …, r_q, where r_k is the number of possible champions after processing k requests.

Example

Input


3 5
RPS
1 S
2 R
3 P
1 P
2 P


Output


2
2
1
2
2
3
#include <bits/stdc++.h>
using namespace std;
namespace fast_IO {
inline int read_int() {
  register int ret = 0, f = 1;
  register char c = getchar();
  while (c < '0' || c > '9') {
    if (c == '-') f = -1;
    c = getchar();
  }
  while (c >= '0' && c <= '9') {
    ret = (ret << 1) + (ret << 3) + int(c - 48);
    c = getchar();
  }
  return ret * f;
}
}  // namespace fast_IO
using namespace fast_IO;
int N, Q;
int a[200005];
char s[200005];
struct BIT {
  int c[200005];
  inline int lowbit(int x) { return x & (-x); }
  inline void add(int pos, int w) {
    while (pos <= N) c[pos] += w, pos += lowbit(pos);
  }
  inline int query(int pos) {
    int res = 0;
    while (pos) res += c[pos], pos -= lowbit(pos);
    return res;
  }
} BIT[3];
set<int> S[3];
inline int decode(char c) {
  if (c == 'R') return 0;
  if (c == 'P') return 1;
  if (c == 'S') return 2;
}
inline void init() {
  N = read_int(), Q = read_int();
  scanf("%s", s + 1);
  for (register int i = 0; i < 3; i++)
    S[i].insert(-0x3f3f3f3f), S[i].insert(0x3f3f3f3f);
  for (register int i = 1; i <= N; i++) {
    a[i] = decode(s[i]);
    BIT[a[i]].add(i, 1);
    S[a[i]].insert(i);
  }
}
inline int calc() {
  if (S[0].size() == N + 2 || S[1].size() == N + 2 || S[2].size() == N + 2)
    return N;
  if (S[0].size() == 2) return S[2].size() - 2;
  if (S[1].size() == 2) return S[0].size() - 2;
  if (S[2].size() == 2) return S[1].size() - 2;
  set<int>::iterator it_min[3], it_max[3];
  for (register int i = 0; i < 3; i++) it_min[i] = S[i].begin(), it_min[i]++;
  for (register int i = 0; i < 3; i++)
    it_max[i] = S[i].end(), it_max[i]--, it_max[i]--;
  int ans = N;
  for (register int i = 0; i < 3; i++) {
    int l1 = (i + 1) % 3, r1 = (i + 2) % 3;
    int L = *it_min[l1], R = *it_min[r1] - 1;
    ans -= max(0, BIT[i].query(R) - BIT[i].query(L - 1));
    L = *it_max[r1], R = *it_max[l1];
    ans -= max(0, BIT[i].query(R) - BIT[i].query(L - 1));
  }
  return ans;
}
inline void ans() {
  printf("%d\n", calc());
  register int pos, nw;
  static char opt[20];
  while (Q--) {
    pos = read_int();
    scanf("%s", opt);
    nw = decode(opt[0]);
    S[a[pos]].erase(pos);
    BIT[a[pos]].add(pos, -1);
    a[pos] = nw, S[a[pos]].insert(pos), BIT[a[pos]].add(pos, 1);
    printf("%d\n", calc());
  }
}
int main() {
  init();
  ans();
  return 0;
}
