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