#include <bits/stdc++.h>
using ll = long long;
using namespace std;
template <typename T>
void dbg_out(T parm) {
  cerr << fixed << setprecision(5) << parm << '\n';
}
int main() {
  ll Tc;
  cin >> Tc;
  while (Tc--) {
    int n;
    cin >> n;
    string s;
    cin >> s;
    int cnt = 0;
    for (int i = 1; i < n; i++) {
      cnt += s[i] == s[i - 1];
    }
    cout << (cnt + 1) / 2 << '\n';
  }
}
