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.*;
import java.util.*;
import java.math.*;
import java.math.BigInteger;
import java.util.LinkedList; 
import java.util.Queue;


public final class A
{    
    static StringBuilder ans=new StringBuilder();
    static FastReader in=new FastReader();
    static ArrayList<ArrayList<Integer>> g;
    static long mod=1000000007;
    static boolean set[];   
   
    public static void main(String args[])throws IOException
    { 	 
    
    	int T=i();
    	while(T-->0)
    	{
    		int N=i();
    		String X=in.next();
    		ArrayList<Integer> A=new ArrayList<Integer>();
    		int x=1;
    		for(int i=1; i<N; i++)
    		{
    			if(X.charAt(i)==X.charAt(i-1))
    			{
    				x++;
    			}
    			else
    			{
    				A.add(x);
    				x=1;
    			}
    		}
    		A.add(x); int c=0;
    		int index=1;
    		for(int i=0; i<A.size(); i++)
    			{
    			   
    			   if(A.get(i)>=2)
    			    {
    				  c++;
    				  index++;
    			    }
    			   else 
    				   {
    				   c++;
    				   boolean f=false;
    				   for(int j=index; j<A.size(); j++)
    				   {
    					   if(A.get(j)>=2)
    					   {
    						   index=j;
    						   f=true;
    						   break;
    					   }
    				   }
    				   if(f)
    				   {
    					   A.set(index, A.get(index)-1);
    				   }
    				   else
    				   {
    					   index=A.size()-1;
    					   A.remove(index);
    				   }
    				  
    				   }
    			}
    		System.out.println(c);
    		
    		
    	}
        	
    }
  static int findIndex(int i, ArrayList<Integer> A)
  {
	  i++;
	  for( ; i<A.size(); i++)
	  {
		 if(A.get(i)>=2)return i; 
	  }
	  return -1;
  }
    	static boolean isSorted(int A[])
    	{
    		for(int i=1; i<A.length; i++)
    		{
    			if(A[i]<A[i-1])return false;
    		}
    		return true;
    	}
    static void f(long N)
    	 {
    		 if(N==1)
    		 {
    			 //ans.append(1);
    			System.out.println(ans);
    		 }
    		 else  if(N%2==0)
    		 {
    			 ans.append(N/2+" ");
    			 f(N/2);
    			 
    		 }
    		 else 
    		 {
    			 N=N*3+1;
    			 ans.append(N+" ");
    			 f(N);
    		 }
    	 }
     static boolean isDivisible(StringBuilder X,int i,long num)
    	 {
    		 long r=0;
    		 for(; i<X.length(); i++)
    		 {
    			 r=r*10+(X.charAt(i)-'0');
    			 r=r%num;
    		 }
    		 return r==0;
    	 }    
     static void print(int A[])
          
     {
  	   for(int i:A)System.out.print(i+" ");
  	System.out.println();   
     }
     

     static void print(long A[])
     {
	 for(long i:A)System.out.print(i+ " ");
	 System.out.println();
          		 
      }
   
     
     static int lower_Bound(int A[],int low,int high, int x) 
        { 
            if (low > high) 
            if (x >= A[high]) 
                return A[high]; 
      
            int mid = (low + high) / 2; 
             
            if (A[mid] == x) 
                return A[mid]; 
      
            if (mid > 0 && A[mid - 1] <= x && x < A[mid]) 
                return A[mid - 1]; 

            if (x < A[mid]) 
                return lower_Bound( A, low, mid - 1, x); 
 
            return lower_Bound(A, mid + 1, high, x); 
        } 
             
    static String f(String A)
    {
    	String X="";
        for(int i=A.length()-1; i>=0; i--)
        {
            int c=A.charAt(i)-'0';
            X+=(c+1)%2;
        }
        return X;
    }

    static void sort(long[] a) //check for long
    {
        ArrayList<Long> l=new ArrayList<>();
        for (long i:a) l.add(i);
        Collections.sort(l);
        for (int i=0; i<a.length; i++) a[i]=l.get(i);
    }

    static String swap(String X,int i,int j)
    {
        char ch[]=X.toCharArray();
        char a=ch[i];
        ch[i]=ch[j];
        ch[j]=a;
        return new String(ch);
    }

    static int sD(long n)  
    {  

        if (n % 2 == 0 )  
            return 2;  

        for (int i = 3; i * i <= n; i += 2) {  
            if (n % i == 0 )  
                return i;  
        }  

        return (int)n;  
    }  

    static void setGraph(int N)
    {
        set=new boolean[N+1];
        g=new ArrayList<ArrayList<Integer>>();
        for(int i=0; i<=N; i++)
            g.add(new ArrayList<Integer>());
    }

    static void DFS(int N,int d)
    {
        set[N]=true;
        d++;
        for(int i=0; i<g.get(N).size(); i++)
        {
            int c=g.get(N).get(i);
            if(set[c]==false)
            {
                DFS(c,d);
            }
        }
    }

    static  long pow(long a,long b)
    {
        long mod=1000000007;
        long pow=1;
        long x=a;
        while(b!=0)
        {
            if((b&1)!=0)pow=(pow*x)%mod;
            x=(x*x)%mod;
            b/=2;
        }
        return pow;
    }

    static long toggleBits(long x)//one's complement || Toggle bits
    {
        int n=(int)(Math.floor(Math.log(x)/Math.log(2)))+1;

        return ((1<<n)-1)^x;
    }

    static int countBits(long a)
    {
        return (int)(Math.log(a)/Math.log(2)+1);
    }

    static long fact(long N)
    { 
        long n=2; 
        if(N<=1)return 1;
        else
        {
            for(int i=3; i<=N; i++)n=(n*i)%mod;
        }
        return n;
    }

    static int kadane(int A[])
    {
        int lsum=A[0],gsum=A[0];
        for(int i=1; i<A.length; i++)
        {
            lsum=Math.max(lsum+A[i],A[i]);
            gsum=Math.max(gsum,lsum);
        }
        return gsum;
    }

    static void sort(int[] a) {
        ArrayList<Integer> l=new ArrayList<>();
        for (int i:a) l.add(i);
        Collections.sort(l);
        for (int i=0; i<a.length; i++) a[i]=l.get(i);
    }

    static boolean isPrime(long N)
    {
        if (N<=1)  return false; 
        if (N<=3)  return true; 
        if (N%2 == 0 || N%3 == 0) return false; 
        for (int i=5; i*i<=N; i=i+6) 
            if (N%i == 0 || N%(i+2) == 0) 
                return false; 
        return true; 
    }

    static int i()
    {
        return in.nextInt();
    }

    static long l()
    {
        return in.nextLong();
    }

    static int[] input(int N){
        int A[]=new int[N];
        for(int i=0; i<N; i++)
        {
            A[i]=in.nextInt();
        }
        return A;
    }

    static long[] inputLong(int N)     {
        long A[]=new long[N];
        for(int i=0; i<A.length; i++)A[i]=in.nextLong();
        return A;
    }

    static long GCD(long a,long b) 
    {
        if(b==0)
        {
            return a;
        }
        else return GCD(b,a%b );
    }

}




class pair implements Comparable<pair>
{
	long a,b;
	pair(long a,long b)
	{
		this.a=a;
		this.b=b;
	}
	public int compareTo(pair x)
	{
		return this.a-x.a;
	}
}

//Code For FastReader
//Code For FastReader
//Code For FastReader
//Code For FastReader
class FastReader
{
    BufferedReader br;
    StringTokenizer st;
    public FastReader()
    {
        br=new BufferedReader(new InputStreamReader(System.in));
    }

    String next()
    {
        while(st==null || !st.hasMoreElements())
        {
            try
            {
                st=new StringTokenizer(br.readLine());
            }
            catch(IOException e)
            {
                e.printStackTrace();
            }
        }
        return st.nextToken();
    }

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

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

    double nextDouble()
    {
        return Double.parseDouble(next());
    }

    String nextLine()
    {
        String str="";
        try
        {
            str=br.readLine();
        }
        catch (IOException e)
        {
            e.printStackTrace();
        }
        return str;
    }

}