#include <bits/stdc++.h>
const unsigned int MOD = 1000000007;
using namespace std;
void solve() {
  int n;
  string s;
  cin >> n >> s;
  int c = 0;
  for (int i = 0; i < n - 1; i++) {
    if (s[i] == s[i + 1]) {
      c++;
    }
  }
  cout << ceil(c / 2.0) << "\n";
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int t;
  cin >> t;
  for (int tt = 0; tt < t; tt++) {
    solve();
  }
  return 0;
}
