#include <stdio.h>

unsigned char s[1000000];
unsigned char *p;
int count;
char c;
int sequence;
FILE *in;

int main()
{
	in=stdin;
	while(1)
		{
			if (!fgets((char*)s, 1000000, in)) break;
			p=s;
			sequence=0;
			while(*p>=' ')
				{
					c=*(p++);
					count=1;
					while(*p==c)
						{
							p++;
							count++;
						}
					while (count>1)
						{							
							if (sequence)
								{
									printf("1");
									sequence=0;
								}
							printf("%d", (count>9)?(9):(count));
							count=(count>9)?(count-9):(0);
							printf("%c", c);
						}
					if (count==1)
						{
							if (!sequence)
								{
									printf("1");
									sequence=1;
								}
							if (c=='1')
								printf("11");
							else
								printf("%c", c);
						}
				}
			if (sequence)
				printf("1");
			printf("\n");
		}
}
