#include <iostream>
#include <string>
#include <map>

int main(){
	std::string t1="aaaaaaaaaabbbbbbbbbbbbcccccccddddddddddeeeeeeefffffffffghiiiiiiiii";
	std::string t2 = "abcddd";
	std::string str;

	while (std::cin >> str){
			
		std::map<char, long> M;
		
		for (auto & o : str)M[o]++;
		for (auto & o : M) {
			std::cout << o.first;
			if (o.second > 1) std::cout << o.second;
		}	
		str = "";
		std::cout << std::endl;
	}
	if (str.size() == 0){
		std::cout << "0";
		std::cout << std::endl;
	}
	return 0;
}