
#include <iostream>
#include <fstream>
#include <string>

using namespace std;

ifstream in("encoding.in");

void writesame(string s)
{
    if (s.size())
        cout << s.size() << s[0];
}

void writediff(string s)
{
    if (!s.size())
        return;
    cout << 1;
    for (int i=0; i<(int)s.size(); i++)
    {
        if (s[i] == '1')
            cout << 1;
        cout << s[i];
    }
    cout << 1;
}

int main()
{
    string line;
    while (getline(cin, line))
    {
        string act;
        bool same = false, diff = false;
        for (int i=0; i<(int)line.size(); i++)
        {
            if (!same && !diff)
            {
                act.push_back(line[i]);
                diff = true;
                continue;
            }
            if (diff)
            {
                if (act[act.size()-1] == line[i])
                {
                    writediff(act.substr(0, act.size()-1));
                    act = string(2, line[i]);
                    diff = false;
                    same = true;
                }
                else
                    act.push_back(line[i]);
            }
            else // same
            {
                if (act.size() < 9 && act[act.size()-1] == line[i])
                    act.push_back(line[i]);
                else
                {
                    writesame(act);
                    act = string(1, line[i]);
                    same = false;
                    diff = true;
                }
            }
        }
        if (diff)
            writediff(act);
        else
            writesame(act);
        cout << endl;
    }

    return 0;
}
