codeforces 1825A
unknown
c_cpp
a year ago
441 B
2
Indexable
Never
int main() { ll t; cin>>t; // cin.ignore(numeric_limits<streamsize>::max(), '\n'); while(t--){ string s; cin>>s; if(s.length()==1){ cout<<-1<<endl; } else{ set<char> x; for(auto i:s){ x.insert(i); } if(x.size()==1){ cout<<-1<<endl; } else{ cout<<s.length()-1<<endl; } } } return 0; }