#include <iostream> #include <map> using namespace std; int main(){ int t; cin>>t; while(t--){ string str; cin>>str; map<char,int> m; for(int i=0;i<str.size();i++){ m[str[i]]++; } for(map<char,int>::iterator it=m.begin();it!=m.end();it++){ cout<<it->second<<it->first; } cout<<endl; } } |
Double click to view unformatted code.