public class Main {
public static void main
(String[] args
) { long num = -10;
int digits = 0;
if (num < 0)
num *= (-1);
if (num < 10 && num >= 0)
digits = 1;
else {
while(num > 0) {
num /= 10;
digits++;
}
}
System.
out.
println("Digits: " +digits
); }
}
cHVibGljIGNsYXNzIE1haW4gewogICAgcHVibGljIHN0YXRpYyB2b2lkIG1haW4oU3RyaW5nW10gYXJncykgewogICAgICAgIGxvbmcgbnVtID0gLTEwOwogICAgICAgIGludCBkaWdpdHMgPSAwOwogICAgICAgIGlmIChudW0gPCAwKSAKICAgICAgICAgICAgbnVtICo9ICgtMSk7CiAgICAgICAgaWYgKG51bSA8IDEwICYmIG51bSA+PSAwKQogICAgICAgICAgICBkaWdpdHMgPSAxOwogICAgICAgIGVsc2UgewogICAgICAgICAgICB3aGlsZShudW0gPiAwKSB7CiAgICAgICAgICAgICAgICBudW0gLz0gMTA7CiAgICAgICAgICAgICAgICBkaWdpdHMrKzsKICAgICAgICAgICAgfQogICAgICAgIH0KICAgICAgICBTeXN0ZW0ub3V0LnByaW50bG4oIkRpZ2l0czogIiArZGlnaXRzKTsKICAgIH0KICAgIAp9