Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- #define ll long long
- void solve()
- {
- ll n;
- cin>>n;
- string s;
- cin>>s;
- ll k = n-1;
- for (ll i=0; i<n-2; i++){
- if (s[i]==s[i+2]) k--;
- }
- cout<<k<<"\n";
- }
- int main()
- {
- int t;
- cin>>t;
- while(t--){
- solve();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement