import java.io.*; import java.util.*; import java.awt.geom.*; /** * Solution to Persistence * * @author vanb */ public class persistence_vanb { public Scanner sc; public PrintStream ps; /** * Driver. * @throws Exception */ public void doit() throws Exception { sc = new Scanner( System.in ); ps = System.out; long number = sc.nextLong(); int count = 0; // While the number has more than 1 digit... while( number >= 10 ) { int newnumber = 1; // While this number still has digits to multiply... while( number>0 ) { // Get the last digit newnumber *= number%10; // Scoot the number over 1 digit number /= 10; } number = newnumber; ++count; } ps.println( count ); } /** * @param args */ public static void main( String[] args ) throws Exception { new persistence_vanb().doit(); } }