#include using namespace std; priority_queueq; int n,m,k,l,s,t,r; string p; vectorans; int main() { ios::sync_with_stdio(false); int T; cin>>T; while (T--) { ans.clear(); while (!q.empty()) q.pop(); cin>>p; l=p.length(); int sum=0; for(int i=0;i=0;i--) { int f; if(q.empty()) f=0; else f=q.top(); if(f>=(1<