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