#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
using namespace std;
int t, n;
vector<int> a, b;
int main() {
  cin >> t;
  while (t--) {
    cin >> n;
    string s;
    cin >> s;
    int ans = 0;
    for (int i = 0; i < ((int)(n - 1)); i++)
      if (s[i] == s[i + 1]) ans++;
    cout << (ans + 1) / 2 << endl;
  }
}
