Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.io.*;
- import java.util.*;
- public class H {
- static BufferedReader input;
- static StringTokenizer _stk;
- static String readln() throws IOException {
- String l = input.readLine();
- if(l!=null) _stk = new StringTokenizer(l, " ");
- return l;
- }
- static String next() { return _stk.nextToken(); }
- static int nextInt() { return Integer.parseInt(next()); }
- public static void main(String[] args) throws IOException {
- Locale.setDefault(Locale.US);
- File asd = new File("book.in");
- input = new BufferedReader(new FileReader(asd));
- String lineaActual;
- int casos=0;
- lineaActual = readln();
- while(true){
- casos++;
- int inicial=nextInt();
- int end=nextInt();
- if(inicial>end){
- int tmp=end;
- end=inicial;
- inicial=tmp;
- }
- String numeros="";
- for(;inicial<=end;inicial++){
- numeros+=inicial;
- }
- int arreglo[] = new int[10];
- for(int i=0;i<numeros.length();i++){
- arreglo[((int)numeros.charAt(i))-48]++;
- }
- System.out.print("Case "+casos+": ");
- for(int i=0;i<arreglo.length;i++){
- System.out.print(i+":"+arreglo[i]);
- if(i!=arreglo.length-1) System.out.print(" ");
- }
- lineaActual = readln();
- if(lineaActual.equals("0")) return;
- else System.out.println();
- }
- }
- }
Add Comment
Please, Sign In to add comment