#include <bits/stdc++.h>
using namespace std;
// #Maps #Hashing #GFG #Problem
// https://practice.geeksforgeeks.org/problems/check-if-a-string-is-isogram-or-not/0/?track=SP-Hashing
bool isIsogram(string x){
map < char, bool > m;
for(int i=0;i<x.size();i++){
if( m[ x[i] ]==true ){
return false; // if char is repeated return false
}
m[ x[i] ]=true;
}
return true;
}
int main() {
int t;
cin>>t;
while(t--){
string x;
cin>>x;
if(isIsogram(x)==true){
cout<<"1"<<endl;
}else{
cout<<"0"<<endl;
}
}
return 0;
}