using System;
public class Test
{
public static void Main()
{
decimal dec = -12345678912345678912345678912.456m;
int digits = GetDigits(dec);
Console.WriteLine(digits.ToString());
}
static int GetDigits(decimal dec)
{
decimal d = decimal.Floor(dec < 0 ? decimal.Negate(dec) : dec);
int cnt = 1;
while ((d = decimal.Floor(d / 10m)) != 0m)
cnt++;
return cnt;
}
}
dXNpbmcgU3lzdGVtOwoKcHVibGljIGNsYXNzIFRlc3QKewoJcHVibGljIHN0YXRpYyB2b2lkIE1haW4oKQoJewoJCWRlY2ltYWwgZGVjID0gLTEyMzQ1Njc4OTEyMzQ1Njc4OTEyMzQ1Njc4OTEyLjQ1Nm07CgkJaW50IGRpZ2l0cyA9IEdldERpZ2l0cyhkZWMpOwoJCUNvbnNvbGUuV3JpdGVMaW5lKGRpZ2l0cy5Ub1N0cmluZygpKTsKCX0KCQoJc3RhdGljIGludCBHZXREaWdpdHMoZGVjaW1hbCBkZWMpCgl7CgkJZGVjaW1hbCBkID0gZGVjaW1hbC5GbG9vcihkZWMgPCAwID8gZGVjaW1hbC5OZWdhdGUoZGVjKSA6IGRlYyk7CgkJaW50IGNudCA9IDE7CgkJd2hpbGUgKChkID0gZGVjaW1hbC5GbG9vcihkIC8gMTBtKSkgIT0gMG0pCgkJICAgIGNudCsrOwoJCXJldHVybiBjbnQ7Cgl9Cn0=