-
Notifications
You must be signed in to change notification settings - Fork 0
/
Solution.java
41 lines (31 loc) · 1.12 KB
/
Solution.java
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
39
40
41
import java.io.*;
import java.util.*;
import java.text.*;
import java.math.*;
import java.util.regex.*;
public class Solution {
public static void main(String[] args)throws IOException {
/* Enter your code here. Read input from STDIN. Print output to STDOUT. Your class should be named Solution. */
String n;
int num, count, divide = 0, len, digit;
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
count = Integer.parseInt(br.readLine());
for (int i = 0; i < count; i++) {
n = br.readLine();
len = n.length();
num = Integer.parseInt(n);
for (int j = 0; j < len; j++) {
try {
digit = num % 10;
if (digit != 0)
if (num % digit == 0)
divide++;
num = num / 10;
} catch (Exception e) {
}
}
System.out.println(divide);
divide = 0;
}
}
}