#include <stdio.h>
int main(void) {
// your code goes here
printf("Count = %d\n",countZeros
(10100) ); printf("Count = %d\n",countZeros
(-10010) ); return 0;
}
int countZeros(int num)
{
// Final stop
if (num == 0 )
return 0;
// Recursion
int count = countZeros(num / 10);
// Increase count if current unit is 0
if (num % 10 == 0)
count++;
return count;
}
I2luY2x1ZGUgPHN0ZGlvLmg+CgppbnQgbWFpbih2b2lkKSB7CgkvLyB5b3VyIGNvZGUgZ29lcyBoZXJlCglwcmludGYoIkNvdW50ID0gJWRcbiIsY291bnRaZXJvcygxMDEwMCkgKTsKCXByaW50ZigiQ291bnQgPSAlZFxuIixjb3VudFplcm9zKC0xMDAxMCkgKTsKCXJldHVybiAwOwp9CgppbnQgY291bnRaZXJvcyhpbnQgbnVtKQp7CgkvLyBGaW5hbCBzdG9wCiAgICBpZiAobnVtID09IDAgKQogICAgCXJldHVybiAwOwoKCS8vIFJlY3Vyc2lvbgogICAgaW50IGNvdW50ID0gY291bnRaZXJvcyhudW0gLyAxMCk7CgoJLy8gSW5jcmVhc2UgY291bnQgaWYgY3VycmVudCB1bml0IGlzIDAKICAgIGlmIChudW0gJSAxMCA9PSAwKQogICAgCWNvdW50Kys7CgogICAgcmV0dXJuIGNvdW50Owp9Cg==