Persistent Number#8377

Persistent Number

1 δευτερόλεπτο
128 megabyte
Πολύ εύκολο

Given a number , we define a function as the product of the digits of . We can then form a sequence x, p(x), p(p(x))... . The persistence of is then defined as the index (-based) of the first single digit number in the sequence. For example, using , we get the sequence 99, 9 \cdot 9 = 81, 8 \cdot 1 = 8. Thus, the persistence of is . You will be given , and you must find its persistence.

Είσοδος

Each line contains one integer n\:(0 \le n \le 2 \cdot 10^9).

Έξοδος

For each number print on a separate line its persistence.

Παραδείγματα

Παράδειγμα 1

Loading
Loading