Untitled
unknown
java
a year ago
508 B
10
Indexable
import java.util.Scanner;
public class P1 {
public static int Sol(int n) {
int sumValue = n % 10;
int temp = n;
while (n != 0) {
sumValue = Math.min(sumValue, n % 10);
n /= 10;
}
int cnt = 0;
while (temp != 0) {
if (temp % 10 == sumValue) {
cnt++;
}
temp /= 10;
}
return cnt;
}
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
System.out.println(Sol(n));
// Sol(n);
}
}
Editor is loading...
Leave a Comment