/* package codechef; // don’t place package name! */
import java.util.;
import java.lang.;
import java.io.*;
import java.lang.Math;
/* Name of the class has to be “Main” only if the class is public. */
class Codechef
{
public static void main (String[] args) throws java.lang.Exception
{
// your code goes herene
int sum=0;
Scanner sc=new Scanner(System.in);
int t=sc.nextInt();
int a[]=new int[26];
while(t–>0){
sum=0;
String s=sc.next();
s=s.toLowerCase();
int n=s.length();
for(int m=0;m<26;m++)
a[m] = 0;
for(int i=0;i<n;i++)
{
a[s.charAt(i)-‘a’]++;
}
for(int j=0;j<26;j++)
{
if(a[j]==0)
continue;
sum=(int)(sum+Math.ceil((a[j])/2.0));
}
System.out.println(sum);
}
}
}