Showing:
Handle Score
@Ibrahim Nash 6560
@mb1973 5777
@Quandray 5275
@akhayrutdinov 5111
@saiujwal13083 5074
@kirtidee18 4419
@sanjay05 3762
@mantu_singh 3666
@gfgaccount 3605
@marius_valentin_dragoi 3525
Count digits in given number N which divide N
Basic Accuracy: 60.0% Submissions: 35 Points: 1

Given a number S(in the form of a string). Count all the digits in S which divide S. Divisibility by 0 is not allowed. If any digit in S which is repeated divides S, then all repetitions of that digit should be counted.

Example 1:

Input:
S = "35"
Output:
1
Explanation:
Only 5 digits 35,thus the answer is 1.

Example 2:

Input:
S = "1122324"
Output:
7
Explanation:
All the digits divide 1122324, therefore,
the answer is 7.

You don't need to read input or print anything.Your task is to complete the function divisibleByDigits()  which takes the number S(in the form of a string) as input parameter and returns the number of digits of S that divide S.

Expected Time Complexity: O(N)
Expected Auxillary S
pace: O(constant)

Constraints:
1<=|S|<=106

### Editorial

We strongly recommend solving this problem on your own before viewing its editorial. Do you still want to view the editorial?

#### My Submissions:

Count digits in given number N which divide N