#include <bits/stdc++.h>
using namespace std;
int t;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  ;
  cin >> t;
  while (t--) {
    int n;
    string s;
    cin >> n >> s;
    int cnt = 0;
    for (int i = 0; i + 1 < n; ++i) {
      if (s[i] != s[i + 1]) {
        ++cnt;
      }
    }
    cout << (n - cnt) / 2 << endl;
  }
  cerr << "Time : " << (double)clock() / (double)CLOCKS_PER_SEC << "s\n";
  return 0;
}
