import java.util.Map; import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); while(sc.hasNext()) { int n = sc.nextInt(); int m = sc.nextInt(); long[] count = new long[10]; for (int i = n; i <= m; i++) { String s = String.valueOf(i); for (int j = 0; j < s.length(); j++) { int num = s.charAt(j)-'0'; count[num]++; } } for (int i = 0; i < 9; i++) { System.out.print(count[i] + " "); } System.out.println(count[9]); } } } |
Double click to view unformatted code.