#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
/* run this program using the console pauser or add your own getch, system("pause") or input loop */
int main(int argc, char *argv[]) {
char turn[1000];
int i,u;
while(gets(turn)!=0){
int count=1;
for(i=0;turn[i]!='\0';i+=count){
count=1;
u=i;
while(turn[u]!='\0'&&turn[u]==turn[u+1]){
count++;
u++;
}
if(count>2){
printf("%d%c",count,turn[i]);
}else{
count==2 ?printf("%c%c",turn[i],turn[i]):printf("%c",turn[i]);
}
}
printf("\n");
}
}