#include<stdio.h> #include<string.h> #include<map> using namespace std; int main() { int t;char a[1010];map<char,int> mp; scanf("%d",&t); while(t--) { mp.clear(); scanf("%s",a); for(int i=0;i<strlen(a);i++) { mp[a[i]]++; } for(map<char,int>::iterator it=mp.begin();it!=mp.end();it++) { printf("%d%c",it->second,it->first); } printf("\n"); } return 0; } |
Double click to view unformatted code.