#include <bits/stdc++.h> #define ll long long #define INF (ll)1e16 using namespace std; const int MOD = 1e9 + 7; // Removed "long long" after const int int getCount(int x ) { int total = 0 ; while(x % 2 == 0 ) { x /= 2 ; total++ ; } return total ; } int main() { int t = 1; cin >> t; while (t--) { ll n ; cin >> n ; string s ; cin >> s ; ll cnt = 0 ; if(s[0] != s[2 ] and s[1] != s[3]) { cnt++ ; } for(ll i = 1 ; i < n - 1 ; i++) { if(s[i] != s[i-1] or s[i+1] != s[i+2]) { cnt++ ; } } cout << cnt << endl ; } return 0; }