#include <stdio.h> #include <string.h> int main(){ int t; int i,j; scanf("%d",&t); int c[26]={0}; char a[1000]; char b[26]={'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'}; while(t--){ scanf("%s",a); for(i=0;i<strlen(a);i++){ for(j=0;j<26;j++){ if(a[i]==b[j]) c[j]++; } } for(j=0;j<26;j++){ if(c[j]!=0){ printf("%d%c",c[j],b[j]); } } } return 0; } |
Double click to view unformatted code.