Multiplicative persistence proposes that any number can be expressed as a single digit number by multiplying the digits of the number and keep following the process with the result until the process throws a single digit number.
You are to write a program that when given a number will show how many steps it will take to make a single digit number number via multiplicative persistence method.
Input file contains N arbitary integer numbers in N lines.
The program should read until the end of file.
Dataset is huge. Usage of faster I/O is advised.
Print the number of steps described above on new lines.
391 873 125
3 4 2
Number given, 391.
Step -1: 3 * 9 * 1 = 27
Step -2: 2 * 7 = 14
Step -3: 1 * 4 = 4
Thus the answer is 3
Problem Setter: Niloy Sarker