#include <bits/stdc++.h>
using namespace std;
int main() {
  string s;
  int n, k;
  cin >> k;
  while (k--) {
    int count = 0;
    cin >> n >> s;
    for (int i = 1; i < n; i++) {
      if (s[i - 1] == s[i]) count++;
    }
    cout << (count + 1) / 2 << endl;
  }
  return 0;
}
