LearnPy Hub
← Loops problems
Hard

Add Digits Until One Is Left

Read n. Keep replacing n by the sum of its digits until it has one digit. Print every number along the way on one line, starting with n.

Input

One integer n ≥ 0.

Output

One line.

Sample 1

Input
9875
Output
9875 29 11 2

Sample 2

Input
5
Output
5
solution.py
Output appears here
Add Digits Until One Is Left · Python practice problem · LearnPy Hub