I am sorry to say that your answer for 178 was not true!
you didn't count the zeros within the number
here I highlite some! see:
26
012189435657951
002
04903227081043611191521875016945785727541837850835631156947382240678577958130457082619920
5758922472595366415651620520158737919845877408325291052446903888118841237643411919510455
0534665861624327194019711390984553672727853709934562985558671936977407000370043078375899
7420676784016967207846280629229032107161669867260548988445514257193985499448939594496064
0451323621402659861930732493697704776060676806701764916694030348199618814556251955925669
1883082551494294759653727484562462882423452659778973774089646655399243592878621251596748
3220976029505696699927284670563747137533019248313587076125412683415860129447566011455420
7495899525635430682886346310849656506827715529962567908452357025521862223581300167008345
2344323682193579318470195651072978180435417389056072742804858399591972902172661229129842
0516067579036232337699453964191475175567557695392233803056825308599977441675784352815913
4613403946049012695420288383471013637338244845066600933484844407119312925376946573543373
7572477223018153403264717753198453734147867432704845798378661870325740593892421570969599
4630557521063203263493209220738320923356309923267504401701760572026010829288042335606643
0898887102973807975780130560495763428386830571906622052911748225105366977566030295740433
8798347151855260280533386635713910104633641976909739743228599421983704697910995630338960
4675889865795711176566670039156748153115943980043625399399731203066490601325311304719028
8984918562037666691644687911252491937544258458950003115616829743046411425380748972817233
7595538066171980140467793561479363526626568333950976000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000
_____
so the correct answer is
332
here is my script run on maple 10 !
I have tested this code with other numbers and I am sure it works! and it is correct
the evaluation time was about 0.56 sec
I again want other guys with some sophisticated algorythms write a faster program, and It'll be a good competition!