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