#include using namespace std; const int maxn=2123456; char s[maxn]; int T,n; vector id; int main() { scanf("%d",&T); while (T--) { scanf("%s",s); int n=strlen(s); int res=1-n%2; id.clear(); int tmp=0; for (int i=0;i=1;--i) { int cnt=0; for (int j=0;j<(int)id.size();++j) { if (id[j]>>i&1) ++cnt; //printf("%d%c",id[j],j+1==(int)id.size()?'\n':' '); } //printf("i=%d cnt=%d\n",i,cnt); if (cnt>1) { for (int j=1;j<=i;++j) res+=1<