#include <stdio.h>
#include <iostream.h>
#include <stdlib.h>
#include <string.h>

int main()
{
	FILE *in;
	FILE *out;
	in=fopen("input.txt", "rt+");
	out=fopen("output.txt", "wt+");
	char txt[1003], txt2[1003], txt3[1003];
	char tem[2];
	int i=0, count=0, j=0,k=0;
	txt2[0]='\0';

	fgets(txt,sizeof(txt),in);
	tem[0]=txt[0];
	while (txt[i]!='\0')
	{
		if (txt[i]==tem[0])
			count++;
		else
		{
			itoa(count,txt3,10);
			for (j=0;j<strlen(txt3);j++)
			{
				txt2[k]=txt3[j];
				k++;
			}
			for (j=0;j<strlen(txt3);j++)
			{
				txt2[k]=tem[0];
				k++;
			}
			tem[0]=txt[i];
			count=0;
		}
		i++;
	}
	txt2[k]='\0';
	fputs(txt2,out);
	return 0;
}



