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