221B.md (752B)
1 Source: https://codeforces.com/problemset/problem/221/B 2 3 B. Little Elephant and Numbers 4 5 time limit per test 6 7 2 seconds 8 9 memory limit per test 10 11 256 megabytes 12 13 input 14 15 stdin 16 17 output 18 19 stdout 20 21 The Little Elephant loves numbers. 22 23 He has a positive integer *x*. The Little Elephant wants to find the number of positive integers *d*, such that *d* is the divisor of *x*, and *x* and *d* have at least one common (the same) digit in their decimal representations. 24 25 Help the Little Elephant to find the described number. 26 27 Input 28 29 A single line contains a single integer *x* (1 ≤ *x* ≤ 109). 30 31 Output 32 33 In a single line print an integer — the answer to the problem. 34 35 Examples 36 37 Input 38 39 ``` 40 1 41 ``` 42 43 Output 44 45 ``` 46 1 47 ``` 48 49 Input 50 51 ``` 52 10 53 ``` 54 55 Output 56 57 ``` 58 2 59 ```