#include <bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7;
template <class T>
void read(T& x) {
  char ch;
  bool sign = 0;
  while (!isdigit(ch = getchar())) {
    if (ch == '-') {
      sign = 1;
    }
  }
  x = ch - '0';
  while (isdigit(ch = getchar())) {
    x = x * 10 + ch - '0';
  }
  if (sign) {
    x = -x;
  }
}
void solve() {
  int n;
  read(n);
  string s;
  cin >> s;
  int o = 0;
  for (int i = 1; i < n; ++i) {
    if (s[i] == s[i - 1]) {
      o++;
    }
  }
  printf("%d\n", (o + 1) / 2);
}
signed main() {
  int tt = 1, case_nu = 1;
  read(tt);
  while (case_nu <= tt) {
    solve();
    case_nu++;
  }
  return 0;
}
