View Code of Problem 36

#include<iostream>
#include<cstring>
using namespace std;
int main(){
	int t;
	cin>>t;
	while(t--){ //控制组数 
		char s[1005];
		scanf("%s",s);
		int num[27] = { };
		for(int i = 0;i<strlen(s);i++){ 
			num[s[i]-'A'+1]++;
		}
		for(int i = 1;i<27;i++){
			if(num[i])
				printf("%d%c",num[i],i + 'A' - 1); 
		}
		printf("\n");
	}
	return 0;
}

Double click to view unformatted code.


Back to problem 36