View Code of Problem 36

    #include <iostream>
    #include<map>
    using namespace std;
      /* run this program using the console pauser or add your own getch, system("pause") or input loop */
    int main(int argc, char** argv) {
    	string str;
    	int n;
    	cin>>n;
    	while(n--){
     
    	cin>>str;
    	map<char,int> mp;
    	for(int i=0;i<str.length();i++){
    		if(str[i]>='A'&&str[i]<='Z'){
    			mp[str[i]]++;
    		}
    	}
    	
    	for(map<char,int>::iterator it=mp.begin();it!=mp.end();it++){
     
    		printf("%d%c",it->second,it->first);
    	}
    	cout<<endl;
    		}
        return 0;
    }

Double click to view unformatted code.


Back to problem 36