import java.io.*;
import java.util.*;

public class encoding
{
		public static void main(String[] args)
				throws IOException
		{
				BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
				String s;
				while ((s = in.readLine()) != null) {
						s += '\n';
						int n = s.length();
						int i = 0;
						char lastChar = '\0';
						boolean ims = false;
						while (i < n) {
								char c = s.charAt(i);
								if (c == lastChar) {
										if (ims) {
												System.out.print(1);
												ims = false;
										}
										int j = i - 1;
										while (true) {
												++i;
												if (i - j >= 9) break;
												if (s.charAt(i) != lastChar) break;
										}
										System.out.print(i - j);
										System.out.print(lastChar);
										lastChar = s.charAt(i);
										++i;
								} else {
										if (!ims && lastChar != '\0') {
												System.out.print(1);
												ims = true;
										}
										if (lastChar != '\0')
												System.out.print(lastChar);
										if (lastChar == '1')
												System.out.print(1);
										lastChar = c;
										++i;
								}
						}
						if (ims)
								System.out.print(1);
						System.out.println();
				}
		}
}
