#include <bits/stdc++.h>
using namespace std;
int n,k;
int a[1000000],b[1000000],i=1,sum=0,gtln=INT_MIN;
int freq[1000000];
string s;
int d=0,dem=0;
int main()
{
    freopen("KTKHAC.inp","r",stdin);
    freopen("KTKHAC.out","w",stdout);
    cin>>n;
    for (int j=0;j<n;j++)
    {
        cin>>s;
        vector <int> freq(129,0);
        for (int i=0;i<s.size();i++)
        {
            freq[int(char(s[i]))]++;
        }
        for (int i=0;i<=129;i++)
        {
            if (freq[i]>0)
                dem++;
        }
    cout<<dem<<endl;
    dem=0;
    }

}
