#include <bits/stdc++.h>
using namespace std;
long long mod(long long a, long long b) {
  long long r = a - b;
  if (r >= 0)
    return r;
  else
    return -1 * r;
}
long long log2(long long a) {
  long long x = 1;
  long long count = 0;
  while (x <= a) {
    x = x * 2;
    count++;
  }
  return count;
}
long long max(long long a, long long b) {
  if (a > b)
    return a;
  else
    return b;
}
long long min(long long a, long long b) {
  if (a < b)
    return a;
  else
    return b;
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long t;
  cin >> t;
  while (t--) {
    long long cnt = 0, n;
    string s;
    cin >> n >> s;
    for (long long i = 1; i < n; i++) {
      if (s[i] == s[i - 1]) cnt++;
    }
    cnt++;
    cout << cnt / 2 << endl;
  }
}
