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