#include <bits/stdc++.h>
using namespace std;
const long long INF = 2e9 + 10;
const int N = 1e7 + 10;
const int MOD = 998244353;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  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';
  }
}
