$x=<>; $y=$x=~s/\.//?10**length$':1; while($x){ ($x,$y)=($y%$x,$x); ++$i; } print$i;