//* Problem  : 1657 - Run Length Encoding
//* Contest  : acm.tju.edu.cn
//* Type     : Solution
//* Date     : 2007.08.04
//* Author   : alt
//* Language : C++
//* Compiler : Microsoft Visual C++ 6.0

#include <stdio.h>
#include <math.h>
#include <string.h>
#include <stdlib.h>
#include <time.h>

char s[100];
int pos;

void code(int k, char ch)
{
	while (k)
	{
		if (k >= 9) 
		{
			putchar('9');
			k -= 9;
		}
		else
		{
			putchar('0'+k);
			k = 0;
		}
		putchar(ch);// if (ch=='1') putchar('1');
	}
}

int main()
{
	int i, st, k;
	while (gets(s))
	{
		pos = 0;
		while (pos < strlen(s))
		{
			st = pos;
			while (s[pos] == s[st] && pos - st < 9) pos++;
			k = pos - st;
			if (k != 1) code(k, s[st]);
			else
			{
				while (s[pos] != s[pos-1] && s[pos] != s[pos+1]) pos++;
				putchar('1');
				for (i = st; i < pos; i++)
				{
					putchar(s[i]);
					if (s[i] == '1') putchar('1');
				}						
				putchar('1');
				}
		}
		putchar('\n'); memset(s, 0, sizeof(s));
	}
}
