#include <bits/stdc++.h>
using namespace std;
const int N = 5e5 + 5;
int tc, n;
int arr[N];
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> tc;
  while (tc--) {
    string s;
    int n, sm = 0;
    cin >> n >> s;
    for (int i = 0; i < s.size(); i++) {
      if (s[i] == s[i + 1]) sm++;
    }
    if (sm % 2 == 0)
      cout << sm / 2 << '\n';
    else
      cout << (sm / 2) + 1 << '\n';
  }
}
