View Code of Problem 36

    #include<bits/stdc++.h>      
    using namespace std;
    #define max 1001
    int main(){    
    	char a[max];
    	int n,num[100] = { };
    	cin>>n;
    	getchar();
    	while(n--){
    		gets(a);
    		for(int i = 0;i<strlen(a);i++)num[a[i]]++;
    		for(int i = 65;i<=90;i++){
    			if(num[i]!=0){
    				cout<<num[i]<<(char)i;
    			}
    		}
    		
    		memset(num,0,sizeof(num));
    		memset(a,0,sizeof(a));
    	}
    	return 0;
    }

Double click to view unformatted code.


Back to problem 36