#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  cin >> t;
  while (t--) {
    string s;
    cin >> s;
    string a, b;
    a += s[0];
    for (int i = 1; i < s.length(); i++) {
      int flag = 0;
      for (int j = 0; j < a.length(); j++) {
        if (s[i] == a[j]) {
          flag = 1;
          int f = 0;
          for (int k = 0; k < b.length(); k++) {
            if (s[i] == b[k]) {
              f = 1;
            }
          }
          if (!f) b += s[i];
        }
      }
      if (!flag) a += s[i];
    }
    int r = 0;
    r += b.length();
    r += (a.length() - b.length()) / 2;
    cout << r << endl;
  }
  return 0;
}
