#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  cin >> t;
  while (t--) {
    string s;
    cin >> s;
    int c = 0;
    int a[26] = {0};
    for (int i = 0; i < (int)(s.size()); ++i) {
      a[s[i] - 'a']++;
    }
    int p = 0;
    for (int i = 0; i < (int)(26); ++i) {
      if (a[i] >= 2) {
        ++c;
      } else if (a[i] == 1) {
        if (p == 0) {
          p = 1;
        } else {
          p = 0;
          ++c;
        }
      }
    }
    cout << c << "\n";
  }
}
