#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;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZSA8c3RyaW5nPgojaW5jbHVkZSA8bWFwPgoKaW50IG1haW4oKXsKCXN0ZDo6c3RyaW5nIHQxPSJhYWFhYWFhYWFhYmJiYmJiYmJiYmJiY2NjY2NjY2RkZGRkZGRkZGRlZWVlZWVlZmZmZmZmZmZmZ2hpaWlpaWlpaWkiOwoJc3RkOjpzdHJpbmcgdDIgPSAiYWJjZGRkIjsKCXN0ZDo6c3RyaW5nIHN0cjsKCgl3aGlsZSAoc3RkOjpjaW4gPj4gc3RyKXsKCQkJCgkJc3RkOjptYXA8Y2hhciwgbG9uZz4gTTsKCQkKCQlmb3IgKGF1dG8gJiBvIDogc3RyKU1bb10rKzsKCQlmb3IgKGF1dG8gJiBvIDogTSkgewoJCQlzdGQ6OmNvdXQgPDwgby5maXJzdDsKCQkJaWYgKG8uc2Vjb25kID4gMSkgc3RkOjpjb3V0IDw8IG8uc2Vjb25kOwoJCX0JCgkJc3RyID0gIiI7CgkJc3RkOjpjb3V0IDw8IHN0ZDo6ZW5kbDsKCX0KCWlmIChzdHIuc2l6ZSgpID09IDApewoJCXN0ZDo6Y291dCA8PCAiMCI7CgkJc3RkOjpjb3V0IDw8IHN0ZDo6ZW5kbDsKCX0KCXJldHVybiAwOwp9