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