Untitled
unknown
java
a year ago
432 B
7
Indexable
import java.util.Scanner;
public class P1 {
public static int Sol(int n) {
int sumValue = n / (int) Math.pow(10, (int) Math.log10(n));
int cnt = 0;
while (n != 0) {
if (sumValue == n % 10) {
cnt++;
}
n /= 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