1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#include<iostream>

using namespace std;

int main()
{
    long long int l, r, pom, mod;
    int count = 0;

    cin>>l>>r;
    
    for(long long int i = l; i <= r; i++)
    {
        pom = i;
        do{
            mod = pom % 10;
            if(mod != 0){
                if(i % mod == 0)
                {
                    pom /= 10; 
                }
                else pom = -1;
            }
            else pom = -1;
            
        }while(pom > 0);

        if(pom == 0)
            count++;

    }

    cout<<count;



    return 0;
}