#include<stdio.h> #include<string.h> int main(){ int count[26]={0}; int t,i,len; char s[1000]; scanf("%d%*c",&t); while(t--) { scanf("%s",&s); len=strlen(s); for(i=0;i<26;i++) count[i]=0; for(i=0;i<len;i++) { if(s[i]>='A' &&s[i]<='Z') count[s[i]-'A']++; } for(i=0;i<26;i++) if(count[i]!=0) printf("%d%c",count[i],'A'+i); printf("\n"); } return 0; } |
Double click to view unformatted code.