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
rajul: 2013-09-23 07:13:41

extra test cases pls...

flop_coder: 2013-08-30 19:15:55

use divisibility rules.....got ac :D

@DubeY@: 2013-08-07 20:09:50

completed half century !!!
easy one but do carefully!!

P_Quantum: 2013-07-31 17:26:14

easy one..!!

***: 2013-07-21 19:34:30

nice one!!!

Vijay Jain: 2013-07-04 12:25:56

after solving this try this one http://www.spoj.com/problems/NITT2/

Chandan Mittal: 2013-05-30 02:43:12

The divisibility by 7 costed me 5WA
but finally got AC :)

Last edit: 2013-05-31 03:16:21
Akb: 2013-03-26 17:51:36

easy one but do it carefully...!!

Vipul Pandey: 2013-03-12 18:05:35

Nice one!


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)