Multiplicative Persistence
Repeatedly replace N with the product of its digits until a single digit remains. Print how many replacements were made.
Input: one integer N.
Output: the multiplicative persistence of N.
Constraints:
- 0 ≤ N ≤ 1018
Sample Tests
Input 1
39
Output 1
3
Input 2
4
Output 2
0
Discussion (opens after you solve — no spoilers before)
No comments yet.