#include<iostream> #define maxN 1005 using namespace std; int main() { char dic[]="ABCDEFGHIJKLMNOPQRSTUVWXYZ"; char s[maxN]; int n; cin>>n; while(n--) { int count[200]= {}; cin>>s; for(int i=0; s[i]!='\0'; i++) { count[(int)s[i]]++; } for(int i=0; dic[i]!='\0'; i++) { if(count[(int)dic[i]]>0) { cout<<count[(int)dic[i]]<<dic[i]; } } cout<<endl; } return 0; } |
Double click to view unformatted code.