View Code of Problem 36

#include<bits/stdc++.h>
using namespace std;
        int main(){    
        	char tmp[1000];
        	int n;
        	scanf("%d\n",&n);
        	for(int i = 0;i<n;i++){
        		int num[100] = { };
        		gets(tmp);
        		for(int i = 0;i<strlen(tmp);i++)num[tmp[i]]++; 
        		for(int i = 65;i<=91;i++){    
        			if(num[i]!=0){
        				cout<<num[i]<<(char)i;
        			}
        		}
        		cout<<endl;	   	    
        	}
        	return 0;
        }

Double click to view unformatted code.


Back to problem 36