using System;
using System.Numerics;
using System.Collections.Generic;

namespace CVRSTI_BROJEVI
{
    class Program
    {
        static void Main(string[] args)
        {

            BigInteger n = BigInteger.Parse(Console.ReadLine());
            List<BigInteger> cl = new List<BigInteger>();
            int l = 0;
            while (n != 0)
            {
                BigInteger x = n % 10;
                cl.Add(x);
                l++;
                n /= 10;
            }

            int s = 0;
            BigInteger[] c = cl.ToArray();
            Array.Reverse(c);

            for(int i = 0; i < l - 1; i++)
            {
                bool ok = true;
                int br = 0;
                for (int j = i + 1; j < l && ok; j++)
                    if (c[i] != c[j])
                        br++;
                    else
                    {
                        if (br == 0)
                            ok = false;
                        if (br == 1)
                        {
                            s++;
                            ok = false;
                            c[i + 1] = c[i]; 
                        }
                        if(br >= 2)
                        {
                            c[i] = c[i + 1];
                            s++;
                            ok = false;
                        }
                    }
            }
            for (int i = 0; i < l; i++)
                Console.WriteLine(c[i]);
            Console.WriteLine(s);
        }
    }
}