PUCMM025  Divisor Digits
Given a number, output how many digits in number that number itself is divisible by. Count all occurences of such digits in the number, not just the first.
For example, 12345 is divisible by 1, 3, and 5, so, the answer in this case must be 3.
Input
Each test case is a number between 1 and 10^{240}.
Output
for each test case, output how many of its digits divide the number.
Example
Input:
12345
661232
312
730000000
Output:
3
3
3
0
hide comments
roy_24:
20160727 08:17:22
Great insight, Arnab Mitra :p 

minhthai:
20160126 14:52:43
java users, u can use BigInteger :) 

geoffreymace7:
20151225 17:50:14
For those stuck on EOF, use while( scanf("%s",str) != EOF ){...},where str stores the number. 

BadeMeow:
20151026 07:09:10
Take care of leading zeros!!! Costed me WA's!


Harish Meena:
20151023 13:13:55
stuck on eof 

shravinson:
20150903 11:11:10
7 is tricky 

Shivam Singh:
20150822 15:56:46
beware of divisibility by 7, 4 and 8


:.Mohib.::
20150715 15:49:45
Learn something....Nice One...!! 

Rishabh Joshi:
20150528 12:01:56
string data type will give TLE due to slower input output (as dynamic mem allocation is involved) suggested using char[] and scanf/printf. 

Arnab Mitra:
20150527 22:08:33
Easy if you can figure out a way to deal with divisibility with 7 
Added by:  Olson Ortiz 
Date:  20111208 
Time limit:  0.207s 
Source limit:  50000B 
Memory limit:  1536MB 
Cluster:  Cube (Intel G860) 
Languages:  C CSHARP C++ 4.3.2 CPP JAVA 
Resource:  Used in 2da Olimpiada de Programacion PUCMMACMISC (fase 2) 