#include <iostream>
#include <map>
#include <list>
int main() {
std::map<char, int> m;
for (int i = 'A'; i <= 'Z'; i++)
m.insert(std::pair<char, int>(i, 0));
std::string s;
std::cin >> s;
std::list<char> l;
std::map<char, int>::iterator p;
for (std::string::iterator q = s.begin(); q != s.end(); q++) {
l.push_back(*q);
p = m.find(*q);
if (p != m.end())
p->second++;
};
std::list<char>::iterator r = l.begin();
while (r != l.end()) {
p = m.find(*r);
if (p != m.end())
if (p->second)
std::cout << p->first << p->second;
char ch = *r;
while (*r == ch)
r++;
l.remove(ch);
}
return 0;
}
/* end */