func_code_string: #include <bits/stdc++.h>   using namespace std;   void solve() {     int n;     cin >> n;     string s;     cin >> s;     int cnt = 0;     vector<int> v;     char last =  * ;     for (int i = 0, to = n; i < to; i++) {       if (last != s[i]) {         if (cnt > 0) v.push_back(cnt);         cnt = 1;         last = s[i];       } else {         cnt++;       }     }     v.push_back(cnt);     int ans = 0;     int resto = 0;     for (int i = 0, to = (int)v.size(); i < to; i++) {       if (v[i] > 1) {         resto -= (v[i] - 2);         resto = max(resto, 0);         ans++;       } else {         resto++;         ans++;       }     }     cout << ans - resto / 2 <<   n ;   }   int main() {     ios::sync_with_stdio(0);     cin.tie(NULL);     int t = 1;     cin >> t;     while (t--) solve();     return 0;   }   