#include <bits/stdc++.h>
#include <iostream>
#include <sstream>
#include <cmath>
#include <math.h>
#include <string>
#include <iomanip>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
#include <deque>
#include <queue>
#define forn(i, n)for(int i = 0; i < int(n); i++)
using namespace std;
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
const double dinf=1e300;
const ll INF=1e18;
const int Mod=1e9+7;
const int maxn=5e5+10;
const ll N = 1'000'000'000'000L;
const int MaX = 1e3 + 11;
unordered_set<ll> cubes;
void Ahmos()
{
cin.tie(NULL);
cout.tie(NULL);
ios_base::sync_with_stdio(false);
}
void Ahmos2()
{
#ifndef ONLINE_JUDGE
freopen("input.txt", "r", stdin);
freopen("output.txt", "w", stdout);
#endif
}
bool isPrime(long long n)
{
if(n<=1)
return false;
for(long long i=2; i<=sqrt(n); i++)
{
if(n%i==0)
return false;
}
return true;
}
ll fact(ll a)
{
ll sum=1;
for(int i=1; i<=a; i++)
{
sum*=i;
}
return sum;
}
void so1()
{
int n;cin>>n;
string s;cin>>s;
long long c=1;
for(int i=2;i<n;i++)
{
if(s[i]==s[i-2])continue;
c++;
}
cout<<c<<endl;
}
int main()
{
Ahmos();
int t=1;
cin>>t;
while(t--)
so1();
}
1487B - Cat Cycle | 1679C - Rooks Defenders |
56A - Bar | 1694B - Paranoid String |
35A - Shell Game | 1684A - Digit Minimization |
43B - Letter | 1017A - The Rank |
1698B - Rising Sand | 235A - LCM Challenge |
1075B - Taxi drivers and Lyft | 1562A - The Miracle and the Sleeper |
1216A - Prefixes | 1490C - Sum of Cubes |
868A - Bark to Unlock | 873B - Balanced Substring |
1401D - Maximum Distributed Tree | 1716C - Robot in a Hallway |
1688B - Patchouli's Magical Talisman | 99A - Help Far Away Kingdom |
622B - The Time | 1688C - Manipulating History |
1169D - Good Triple | 1675B - Make It Increasing |
588A - Duff and Meat | 1541B - Pleasant Pairs |
1626B - Minor Reduction | 1680A - Minimums and Maximums |
1713A - Traveling Salesman Problem | 1713B - Optimal Reduction |