#include <iostream> #include <string.h> using namespace std; int main(){ int n; char str[1001]; scanf("%d",&n); while(n--){ int c[26]={0}; scanf("%s",str); int len = strlen(str); for(int j=0;j<len;j++){ c[str[j]-'A']++; } for(int k=0;k<26;k++){ if(c[k]!=0){ printf("%d%c",c[k],'A'+k); } } printf("\n"); } return 0; } |
Double click to view unformatted code.