#include <string>
#include <iostream>
#include <algorithm>
#include <sstream>

std::string cond(std::string const& in) {    
    unsigned long table[ 26 ] = { 0 }; /* known fixed charset */
    std::for_each(in.begin(), in.end(), [&table](char c){ table[ c - 'a' ]++; });
    std::stringstream out;
	for (size_t v = 0; v < 26; ++v) if (table[ v ]) out << table[ v ] << char(v + 'a');
	return out.str();
}

int main(){
    std::string in = "aaabbbbcccccdde";
    std::cout << cond(in);    
}