You have a string s consisting of n characters. Each character is either 0 or 1.

You can perform operations on the string. Each operation consists of two steps:

  1. select an integer i from 1 to the length of the string s, then delete the character s_i (the string length gets reduced by 1, the indices of characters to the right of the deleted one also get reduced by 1); 
  2. if the string s is not empty, delete the maximum length prefix consisting of the same characters (the indices of the remaining characters and the string length get reduced by the length of the deleted prefix). 



Note that both steps are mandatory in each operation, and their order cannot be changed.

For example, if you have a string s = 111010, the first operation can be one of the following:

  1. select i = 1: we'll get 111010 → 11010 → 010; 
  2. select i = 2: we'll get 111010 → 11010 → 010; 
  3. select i = 3: we'll get 111010 → 11010 → 010; 
  4. select i = 4: we'll get 111010 → 11110 → 0; 
  5. select i = 5: we'll get 111010 → 11100 → 00; 
  6. select i = 6: we'll get 111010 → 11101 → 01. 



You finish performing operations when the string s becomes empty. What is the maximum number of operations you can perform?

Input

The first line contains a single integer t (1 ≤ t ≤ 1000) — the number of test cases.

The first line of each test case contains a single integer n (1 ≤ n ≤ 2 ⋅ 10^5) — the length of the string s.

The second line contains string s of n characters. Each character is either 0 or 1.

It's guaranteed that the total sum of n over test cases doesn't exceed 2 ⋅ 10^5.

Output

For each test case, print a single integer — the maximum number of operations you can perform.

Example

Input


5
6
111010
1
0
1
1
2
11
6
101010


Output


3
1
1
1
3

Note

In the first test case, you can, for example, select i = 2 and get string 010 after the first operation. After that, you can select i = 3 and get string 1. Finally, you can only select i = 1 and get empty string.


import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedList;
import java.util.PriorityQueue;
import java.util.Queue;
import java.util.StringTokenizer;



public class COVID {

	static long mod = (int) 1e9 + 7;
	static PrintWriter pw;
		static int n,m;
		
		static ArrayList<Integer>[] adjList;
		


public static void main(String[] args) throws Exception {
			Scanner sc = new Scanner(System.in);
			PrintWriter pw = new PrintWriter(System.out);
			int t=sc.nextInt();
		h:	while(t-->0) {
			int n=sc.nextInt();
			char[] s=sc.nextLine().toCharArray();
			int id=0;
			HashMap<Integer,Integer> map=new HashMap<>();
			PriorityQueue<Pair> pq=new PriorityQueue<>();
			int ones=0;
			ArrayList<Integer> pos=new ArrayList<>();
			while(id<n) {
				int j=id;
				int cnt=0;
				while(j<n&&s[j]==s[id]) {
					cnt++;
					j++;
				}
				map.put(id,cnt);
				pq.add(new Pair(id,cnt));
				pos.add(id);
				id=j;
			}
			HashSet<Integer> done=new HashSet();
			int ans=0;
			for(int i=0;i<n;i++) {
				if(!map.containsKey(i))continue;
				if(map.get(i)>1) {
					ans++;
					done.add(i);
					map.remove(i);
				}else if(map.get(i)==1) {
					while(!pq.isEmpty()&&(done.contains(pq.peek().x)||pq.peek().y<=1))
						{
						pq.poll();
						}
					 if(pq.isEmpty()) {
						 break;
					 }
					
					 Pair p=pq.poll();
						map.put(p.x, p.y-1);
						pq.add(new Pair(p.x,p.y-1));
						done.add(i);
						ans++;
					
				}
			}
		for(int num:pos)
			if(!done.contains(num))
				ones++;
			ans+=(ones+1)/2;
			pw.println(ans);
		}
			pw.flush();
		}
			

		
		static class longPair implements Comparable<longPair> {
		long x, y;

		public longPair(long a, long b) {
			x = a;
			y = b;
		}

		public int compareTo(longPair p) {
			return (p.x == x) ? ((p.y == y) ? 0 : (y > p.y) ? 1 : -1) : (x > p.x) ? 1 : -1;
		}
	}


	static class Pair implements Comparable<Pair> {
		int x;
		int y;

		public Pair(int a, int b) {
			this.x = a;
			y = b;
		}


		public int compareTo(Pair o) {
			return (x == o.x) ? ((y > o.y) ? 1 : (y == o.y) ? 0 : -1) : ((x > o.x) ? 1 : -1);
		}

		@Override

		public int hashCode() {
			final int prime = 31;
			int result = 1;
			result = prime * result + x;
			result = prime * result + y;
			return result;
		}

		@Override

		public boolean equals(Object obj) {
			if (this == obj)
				return true;
			if (obj == null)
				return false;
			if (getClass() != obj.getClass())
				return false;
			Pair other = (Pair) obj;
			if (x != other.x)
				return false;
			if (y != other.y)
				return false;
			return true;
		}

	}

	static class Scanner {
		StringTokenizer st;
		BufferedReader br;

		public Scanner(InputStream s) {
			br = new BufferedReader(new InputStreamReader(s));
		}

		public Scanner(String s) throws FileNotFoundException {
			br = new BufferedReader(new FileReader(s));
		}

		public long[] nextLongArr(int n) throws IOException {
			long[] arr = new long[n];
			for (int i = 0; i < n; i++)
				arr[i] = nextLong();
			return arr;
		}

		public int[] nextIntArr(int n) throws IOException {
			int[] arr = new int[n];
			for (int i = 0; i < n; i++)
				arr[i] = nextInt();
			return arr;
		}

		public String next() throws IOException {
			while (st == null || !st.hasMoreTokens())
				st = new StringTokenizer(br.readLine(), " ,");
			return st.nextToken();
		}

		public int nextInt() throws IOException {
			return Integer.parseInt(next());
		}

		public long nextLong() throws IOException {
			return Long.parseLong(next());
		}

		public String nextLine() throws IOException {
			return br.readLine();
		}

		public double nextDouble() throws IOException {
			String x = next();
			StringBuilder sb = new StringBuilder("0");
			double res = 0, f = 1;
			boolean dec = false, neg = false;
			int start = 0;
			if (x.charAt(0) == '-') {
				neg = true;
				start++;
			}
			for (int i = start; i < x.length(); i++) {
				if (x.charAt(i) == '.') {
					res = Long.parseLong(sb.toString());
					sb = new StringBuilder("0");
					dec = true;
				} else {
					sb.append(x.charAt(i));
					if (dec)
						f *= 10;
				}
				if (sb.length() == 18) {
					res += Long.parseLong(sb.toString()) / f;
					sb = new StringBuilder("0");
				}
			}
			res += Long.parseLong(sb.toString()) / f;
			return res * (neg ? -1 : 1);
		}

		public boolean ready() throws IOException {
			return br.ready();
		}

	}

	public static void shuffle(int[] a) {
		int n = a.length;
		for (int i = 0; i < n; i++) {
			int r = i + (int) (Math.random() * (n - i));
			int tmp = a[i];
			a[i] = a[r];
			a[r] = tmp;
		}
	}

}