PUCMM025 - Divisor Digits

no tags 

Given a number, output how many digits of that number the number is itself divisible by. Count all occurrences 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 10240.

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
$!:D: 2013-01-26 10:05:50

getting tle...bt i think my code is very short... plzz help
soln. id 8587730

Last edit: 2013-01-26 10:13:11
milkyway: 2012-10-03 19:23:29

applied all primary mathematics... :)

bristy: 2011-12-24 02:27:52

what will have to do for terminating the prog in c++.(how to reach at EOF);
kk
got AC|
for EOF use>> while(scanf("%s",str)!=EOF).

Last edit: 2011-12-24 13:48:35
cegprakash: 2011-12-13 17:13:02

could u make a copy of this problem in tutorial section with increased time limit so that i can check my time

mukesh tiwari: 2011-12-11 22:38:26

Would it be possible for you to allow this in Haskell. Probably moving a same copy with increased time limit in tutorial section.


Added by:Olson Ortiz
Date:2011-12-08
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 PUCMM-ACM-ISC (fase 2)