description: This is a simplified version of the problem B2. Perhaps you should read the problem B2 before you start solving B1.
  
  Paul and Mary have a favorite string s which consists of lowercase letters of the Latin alphabet. They want to paint it using pieces of chalk of two colors: red and green. Let's call a coloring of a string wonderful if the following conditions are met:
  
    1. each letter of the string is either painted in exactly one color (red or green) or isn't painted; 
    2. each two letters which are painted in the same color are different; 
    3. the number of letters painted in red is equal to the number of letters painted in green; 
    4. the number of painted letters of this coloring is maximum among all colorings of the string which meet the first three conditions. 
  
  
  
  E. g. consider a string s equal to "kzaaa". One of the wonderful colorings of the string is shown in the figure.
  
  <image> The example of a wonderful coloring of the string "kzaaa".
  
  Paul and Mary want to learn by themselves how to find a wonderful coloring of the string. But they are very young, so they need a hint. Help them find k — the number of red (or green, these numbers are equal) letters in a wonderful coloring.
  
  Input
  
  The first line contains one integer t (1 ≤ t ≤ 1000) — the number of test cases. Then t test cases follow.
  
  Each test case consists of one non-empty string s which consists of lowercase letters of the Latin alphabet. The number of characters in the string doesn't exceed 50.
  
  Output
  
  For each test case, output a separate line containing one non-negative integer k — the number of letters which will be painted in red in a wonderful coloring.
  
  Example
  
  Input
  
  
  5
  kzaaa
  codeforces
  archive
  y
  xxxxxx
  
  
  Output
  
  
  2
  5
  3
  0
  1
  
  Note
  
  The first test case contains the string from the statement. One of the wonderful colorings is shown in the figure. There's no wonderful coloring containing 3 or more red letters because the total number of painted symbols will exceed the string's length.
  
  The string from the second test case can be painted as follows. Let's paint the first occurrence of each of the letters "c", "o", "e" in red and the second ones in green. Let's paint the letters "d", "f" in red and "r", "s" in green. So every letter will be painted in red or green, hence the answer better than 5 doesn't exist.
  
  The third test case contains the string of distinct letters, so you can paint any set of characters in red, as long as the size of this set doesn't exceed half of the size of the string and is the maximum possible.
  
  The fourth test case contains a single letter which cannot be painted in red because there will be no letter able to be painted in green.
  
  The fifth test case contains a string of identical letters, so there's no way to paint more than one letter in red.
solution: import java.util.*;
  import java.io.*;
  
  public class Main{
  
      public static void main(String[] args) {
          MyScanner sc = new MyScanner();
          out = new PrintWriter(new BufferedOutputStream(System.out));
          
          // Start writing your solution here. -------------------------------------
          /*
          int n      = sc.nextInt();        // read input as integer
          long k     = sc.nextLong();       // read input as long
          double d   = sc.nextDouble();     // read input as double
          char c = sc.next().charAt(0);     // read input as char
          String str = sc.next();           // read input as String
          String s   = sc.nextLine();       // read whole line as String
          out.println(result);              // print via PrintWriter
          */
          //------------------------------------------------------------------
  
          int test= sc.nextInt();
  
          while(test -- > 0){
              char[] curr = sc.nextLine().toCharArray();
              int[] arr = new int[26];
  
              for(char ch : curr){
                  arr[ch-'a']++;
              }
  
              int first = 0;
              int second = 0;
              int third = 0;
  
              for(int i = 0 ; i < 26 ; i++){
                  if(arr[i] == 1){
                      third++;
                  }
                  if(arr[i] >= 2){
                      first++;
                      second++;
                  }
              }
              first += third/2;
              System.out.println(first);
          }
  
  
  
          //------------------------------------------------------------------
          
          // Stop writing your solution here. -------------------------------------
          out.close();
      }
  
      //-------------------------------------------------------------------
      //-------------------------------------------------------------------
      //-------------------------------------------------------------------
      //-------------------------------------------------------------------
      //-------------------------------------------------------------------
  
      //for calculating binomialCoeff
      public static int binomialCoeff(int n, int k)
      {
          int C[] = new int[k + 1];
          // nC0 is 1
          C[0] = 1;
          for (int i = 1; i <= n; i++) {
              // Compute next row of pascal
              // triangle using the previous row
              for (int j = Math.min(i, k); j > 0; j--)
                  C[j] = C[j] + C[j - 1];
          }
          return C[k];
      }
  
      //Pair with int int 
      public static class Pair{
  
          public int a;
          public int b;
  
          Pair(int a , int b){
              this.a = a;
              this.b = b;
          }
      }
  
      //Shortcut function
      public static long lcm(long a , long b){
          return a * (b/gcd(a,b));
      }
  
      //let's make one for calculating lcm basically
      public static int lcm(int a , int b){
          return (a * b)/gcd(a,b);
      }
  
      //int version for gcd
      public static int gcd(int a, int b){
          if(b == 0)
              return a;
              
          return gcd(b , a%b);
      }
  
      //long version for gcd
      public static long gcd(long a, long b){
          if(b == 0)
              return a;
  
          return gcd(b , a%b);
      }
  
      //swapping two elements in an array
      public static void swap(int[] arr, int left , int right){
          int temp = arr[left];
          arr[left] = arr[right];
          arr[right] = temp;
      }
  
      //reversing an array
      public static void reverse(int[] arr){
          int left = 0;
          int right = arr.length-1;
  
          while(left <= right){
              swap(arr, left,right);
              left++;
              right--;
          }
      }
  
       
      //-----------PrintWriter for faster output---------------------------------
      public static PrintWriter out;
        
      //-----------MyScanner class for faster input----------
      public static class MyScanner {
        BufferedReader br;
        StringTokenizer st;
   
          public MyScanner() {
              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;
          }
  
      }
     //--------------------------------------------------------
  }