#include <bits/stdc++.h>
using namespace std;
template <class T>
using min_heap = priority_queue<T, vector<T>, greater<T> >;
template <class T>
using max_heap = priority_queue<T>;
const double PI = acos(-1);
const int INF = 0x3f3f3f3f;
const long long int LINF = (long long int)2e18;
double eps = 1e-5;
long long int mod = 1000000007LL;
long long int powmod(long long int a, long long int b) {
  long long int res = 1;
  a %= mod;
  assert(b >= 0);
  for (; b; b >>= 1) {
    if (b & 1) res = res * a % mod;
    a = a * a % mod;
  }
  return res;
}
long long int powb(long long int a, long long int b) {
  long long int res = 1;
  a;
  assert(b >= 0);
  for (; b; b >>= 1) {
    if (b & 1) res = res * a;
    a = a * a;
  }
  return res;
}
const int SIZE = 2000;
bool judge(int a[], int n) {
  static int used[SIZE + 1];
  for (int i = 1; i <= n; i++) used[i] = 0;
  for (int i = 0; i < n; i++) used[a[i]] = 1;
  for (int i = 1; i <= n; i++) {
    if (!used[i]) return 0;
  }
  return 1;
}
long long int fact[SIZE], inv[SIZE];
long long int ncr(long long int n, long long int r) {
  if (n < r) return 0;
  return ((fact[n] * inv[n - r]) % mod * inv[r]) % mod;
}
void funct() {
  fact[0] = 1;
  for (long long int i = 1; i < SIZE; i++) {
    fact[i] = fact[i - 1] * i % mod;
  }
  inv[SIZE - 1] = powmod(fact[SIZE - 1], mod - 2);
  for (long long int i = SIZE - 2; i >= 0; i--) {
    inv[i] = inv[i + 1] * (i + 1) % mod;
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  cerr.tie(NULL);
  int t;
  cin >> t;
  while (t--) {
    int n;
    cin >> n;
    string s;
    cin >> s;
    int cnt = 0;
    for (int i = 1; i < n; i++) {
      if (s[i] == s[i - 1]) cnt++;
    }
    cout << (cnt + 1) / 2 << "\n";
  }
  return 0;
}
