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