A number is called quasibinary if its decimal representation contains only digits 0 or 1. For example, numbers 0, 1, 101, 110011 — are quasibinary and numbers 2, 12, 900 are not.

You are given a positive integer n. Represent it as a sum of minimum number of quasibinary numbers.


-----Input-----

The first line contains a single integer n (1 ≤ n ≤ 10^6).


-----Output-----

In the first line print a single integer k — the minimum number of numbers in the representation of number n as a sum of quasibinary numbers.

In the second line print k numbers — the elements of the sum. All these numbers should be quasibinary according to the definition above, their sum should equal n. Do not have to print the leading zeroes in the numbers. The order of numbers doesn't matter. If there are multiple possible representations, you are allowed to print any of them.


-----Examples-----
Input
9

Output
9
1 1 1 1 1 1 1 1 1 

Input
32

Output
3
10 11 11

Difficulty: interview

Starter code:

Solutions:
import sys

def get_max_kvazi(n):
    s = str(n)
    ans = ''
    for c in s:
        if c == '0':
            ans = ans + '0'
        else:
            ans = ans + '1'
    return int(ans)

fin = sys.stdin
fout = sys.stdout

#fin = open("input.txt", 'r')
#fout = open("output.txt", 'w')

n = int(fin.readline())
ans = []
while (n > 0):
    cur = get_max_kvazi(n)
    ans.append(cur)
    n -= cur
print(len(ans))
print(*ans)


n = list(map(int, list(input().strip())))
ans = []
while any(n):
    cur = 0
    for i in range(len(n)):
        cur *= 10
        if n[i]:
            cur += 1
            n[i] -= 1
    ans.append(cur)
print(len(ans))
print(*ans)


#!/usr/bin/env python3

n = list(map(int, input()))

elems = []
while sum(n) > 0:
    x = ''
    for i, v in enumerate(n):
        if v:
            x += '1'
            n[i] -= 1
        else:
            x += '0'
    elems.append(int(x))

print(len(elems))
print(*elems)


3

def main():
    s = list(map(int, input()))
    ans = [[1]]
    while ans[-1] != [0 for i in range(len(s))]:
        ans.append([0 for i in range(len(s))])
        for i in range(len(s)):
            if s[i] > 0:
                ans[-1][i] = 1
                s[i] -= 1
    print(len(ans) - 2)
    for i in range(1, len(ans) - 1):
        print(int(''.join(map(str, ans[i]))), end=' ')
    print()


main()



n = list(reversed(input()))

outs = [0] * 9

for i in range(len(n)):
    for x in range(int(n[i])):
        outs[x] += 10**i

outs = list([_f for _f in outs if _f])
print(len(outs))
print(*outs)


__author__ = 'Данила'
n = (input())
a = []
s = int(n)
min = 0
for i in range(len(n)):
    if int(n[i]) > min:
        min = int(n[i])
print(min)
while s != 0:
    s1 = str(s)
    k = ''
    for i in range(len(s1)):
        if s1[i] != '0':
            k += '1'
        else:
            k += '0'
    print(k, end = ' ')
    s -= int(k)



k = [int(i) for i in input()]
print(max(k))
nums = []
while max(k) > 0:
    d = ['0']*len(k)
    for x in range(len(k)):
        if k[x] > 0:
            k[x] -= 1
            d[x] = '1'
    n = ''.join(d)
    while n[0] == '0':
        n = n[1:]
    nums.append(n)
print(' '.join(nums))


3
# -*- coding: utf8 -*-

def main():
    s = list(map(int, input()))
    ans = []
    while max(s) != 0:
        t = []
        for i in range(len(s)):
            t.append('1' if s[i] else '0')
            s[i] = max(0, s[i] - 1)
        ans.append(t)
    print(len(ans))
    print(' '.join([''.join(_).lstrip('0') for _ in ans]))

def __starting_point():
    main()

__starting_point()

def main():
    n = [int(i) for i in input()]
    
    number = max(n)
    
    print(number)
    for i in range(number):
        k = []
        for j in n:
            if j > i:
                k.append(1)
            elif k:
                k.append(0)
        print(''.join(str(i) for i in k), end=' ')
    print()

main()


n = int(input())
k = n
ans = []
while k != 0:
    s = str(k)
    bin = ''
    for c in s:
        if c == '0':
            bin += '0'
        else:
            bin += '1'
    d = int(bin)
    ans.append(d)
    k -= d
print(len(ans))
print(' '.join(map(str, ans)))

n = input()
answer = []
for j in range(int(n[0])):
    answer.append(10 ** (len(n) - 1))
for i in range(1, len(n)):
    j = 0
    while j < len(answer) and j < int(n[i]):
        answer[j] += 10 ** (len(n) - i - 1)
        j += 1
    if j < int(n[i]):
        while j < int(n[i]):
            answer.append(10 ** (len(n) - i - 1))
            j += 1
print(len(answer))
print(*answer)

3

import sys

n = int(input())

nums = []
while n != 0:
    num = 0
    pow10 = 1
    while n >= pow10:
        if n % (pow10 * 10) >= pow10:
            num += pow10
            n -= pow10
        pow10 *= 10
    nums.append(num)
    # sys.stdout.write(str(num) + " ")

print(len(nums))
print(" ".join(map (str, nums)))


n = input()
ans1 = max([int(x) for x in n])
ans2 = ['' for _ in range(ans1)]
for i in n:
    cnt = int(i)
    for j in range(ans1):
        if cnt > 0:
            ans2[j] += '1'
            cnt -= 1
        else:
            ans2[j] += '0'
print(ans1)
print(' '.join([str(int(x)) for x in ans2]))





def main(k):
    num = list(map(int, k))
    res = []
    while True:
        st = []
        flag = False
        for i in range(len(num)):
            if num[i] > 0:
                st.append('1')
                num[i] -= 1
                flag = True
            else:
                st.append('0')
        if not flag:
            break
        res.append(str(int("".join(st))))
    print(str(len(res)))
    print(" ".join(res))


def __starting_point():
    s = input()
    main(s)

__starting_point()

n=int(input())
def nearest(n):
    instr=str(n)
    length=len(instr)
    to_ret=10**(length-1)
    for i in range(1, length):
        if int(instr[i])>=1:
            to_ret+=10**(length-i-1)

    return to_ret
i=0
chisla=[]
while n!=0:
    d=nearest(n)
    chisla.append(d)
    n-=d
    i+=1

print(i)
for c in range(i):
    print(chisla[c], end=' ')


import sys
f = sys.stdin

s = f.readline().strip()
si = []
for i in range(len(s)):
    si.append(int(s[i]))

r = []

for k in range(9):
    ki = 0
    for i in range(len(si)):
        if si[i]>0:
            si[i] -= 1
            ki += 10**(len(si)-i-1)
    if ki==0:
        break
    r.append(str(ki))
        
 
print(len(r))
print(' '.join(r))   


l = list(map(int,list(input())))
print(max(l))
ans = []
while l.count(0) != len(l):
    k = ['0' for i in range(len(l))]
    for i in range(len(l)):
        if l[i] != 0:
            l[i] -= 1
            k[i] = '1'
    ans.append(str(int(''.join(k))))
print(' '.join(ans))


n = int(input())
s = str(n)
m = int(max(s))
print(m)
for i in range(m):
    ed = False
    for j in range(len(s)):
        if int(s[j]) > i:
            ed = True
            print(1, end='')
        else:
            if ed:
                print(0, end='')
    print(' ', end='')

s=list(map(int, list(input().strip())))
print(max(s))   
while s:
    if s[0]==0:
        s=s[1:]
        continue
    for i in range(len(s)):
        if s[i]!=0:
            print(1,end='')
            s[i]-=1
        else:
            print(0, end='')
    print(end=' ')

num = input()
le = len(num)
num2 = [0] * le
for i in range(le):
    num2[i] = int(num[i])
print(max(num2))
for i in range(le):
    while num2[i] > 0:
        print(1,end="")
        for j in range(i+1,le):
            if num2[j] > 0:
                num2[j] -= 1
                print(1,end="")
            else:
                print(0,end="")
        print(" ",end="")
        num2[i] -= 1


n = input()
ans = int(max(list(n)))
print(ans)
for i in range(ans):
    num = ""
    for pos in range(len(n)):
        if int(n[pos]) >= i + 1:
            num += "1"
        else:
            num += "0"
    print(int(num), end = " ")

n = int(input())
m = 0
c = 1
i = n
while i > 0:
    m = max(m, i % 10)
    i = i // 10
a = [0] * m
i = n
while i > 0:
    for j in range(i % 10):
        a[j] += c
    c = c * 10
    i = i // 10
print(m)
for i in range(m):
    print(a[i], end=' ')

a = input()
j = 0
b = []
for i in a:
    if j < int(i):
        j = int(i)
print(j)
for i in range(j):
    b.append(0)
mult = 1
for i in a[::-1]:
    for k in range(int(i)):
        b[k] += mult
    mult *= 10
for i in range(j):
    print(b[i], end = ' ')


n = input()
B = [0 for i in range(7)]
while len(n) != 7:
    n = '0' + n
ans = 0
for i in range(7):
    ans = max(ans, int(n[i]))
    B[i] = int(n[i])
print(ans)
s = ''
for i in range(ans):
    cur = [0 for i in range(7)]
    for j in range(7):
        if B[j] > 0:
            cur[j] = 1
            B[j] -= 1
    was = False
    for j in range(7):
        if cur[j] == 1:
            s += '1'
            was = True
        elif was:
            s += '0'
    s += ' '
print(s[:-1])


n  = int(input())
sn = str(n)
l  = len(sn)

def getDecimal(n):
	return (len(str(n)) - 1)

def intAr(a):
	b = []
	for i in a:
		b.append(int(i))
	return b

def getQDNumber(number):
	inum = int(number)
	_n = intAr(number)
	n = ''
	pointer = 0
	_len = len(number)

	if inum:
		if inum >= 10:
			while 1:
				if _n[pointer] is 0:
					n += '0'
				else:
					_n[pointer] -= 1
					n += '1'

				pointer += 1

				if pointer >= _len:
					break
		else:
			n = '1'
		if inum - int(n) >= 0:
			return n + ' ' + str(getQDNumber(str(inum - int(n))))
	return ''

n = getQDNumber(sn)
print(len(n.split(' ')) - 1)
print(n)