import java.io.*;

class code1
{
	public static void main(String args[]) throws Exception 
	{
		File ii = new File ("C-small-attempt1.in");
		FileInputStream fis = new FileInputStream(ii);
		BufferedReader  br = new BufferedReader(new InputStreamReader (fis));
		int cases = Integer.parseInt(br.readLine());
		FileOutputStream fout = new FileOutputStream ("output.txt");
		DataOutputStream dout = new DataOutputStream (fout);
		int total=0;
		for(int i=0;i<cases;i++){
		String temp = br.readLine();
		String parts [] = temp.split(" ");
		int lower = Integer.parseInt(parts[0]);
		int upper = Integer.parseInt(parts[1]);
		System.out.println(lower+" "+upper);
		
		for(int j=lower;j<=upper;j++)
		{
			int abc = j;int length=0;
			if(j<10)continue;
			while (abc!=0){abc/=10;length++;}
			abc=j;
			for(int m=0;m<length-1;m++){
				int shift = abc%10;
				abc=abc/10;
				System.out.println("hi "+j);
				abc=abc+shift*power(10,length-1);
				if(abc<=upper&&shift!=0&&abc>j)total++;
				System.out.println(total);
			}
		}
 		dout.writeBytes("Case #"+(i+1)+ ": "+total+"\n");
 		total=0;
		}//for close
		
	}

	private static int power(int i, int j) {
		int no=1;
		for(int a=0;a<j;a++){no=10*no;}
		return no;
	}
}
package template;

import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.util.ArrayList;

public class TestCaseIO {

    public static ArrayList<TestCase> loadFromFile(String infile) {
        //inc checks on #lines, length of splits, etc.
        BufferedReader br = Utils.newBufferedReader(infile);
        ArrayList<TestCase> tcList = new ArrayList<>();

        //first line is N, the number of test cases
        Integer N = Utils.readInteger(br);

        //cycle through N test cases
        for (int x = 0; x < N; x++) {
            TestCase tc = new TestCase();
            tc.setRef(x + 1);

            ///////////////////////////////////////////////////////////
            //load properties - the bit to customise per problem
            ArrayList<Integer> l = Utils.readIntegerList(br, 2);
            tc.setIntegerList("a_b", l);

            ///////////////////////////////////////////////////////////

            tcList.add(tc);
        }

        //confirm end of file
        if (Utils.readLn(br) != null) {
            Utils.die("Unexpected text at end of infile");
        }

        return tcList;
    }

    public static ArrayList<TestCase> mockUp() {

        ArrayList<TestCase> tcList = new ArrayList<>();
        for (int i = 0; i < 10; i++) {
            TestCase tc = new TestCase();
            tc.setRef(i);
            
            int[] xs = Utils.randomIntegerArray(100, -50, 50, i * 2);
            int[] ys = Utils.randomIntegerArray(100, -50, 50, i * 2 + 1);
            tc.setIntegerList("xs", Utils.arrayToArrayList(xs));
            tc.setIntegerList("ys", Utils.arrayToArrayList(ys));

            tcList.add(tc);
        }
        return tcList;
    }

    public static void writeSolutions(ArrayList<TestCase> tcList, String outfile) {

        BufferedWriter bw = Utils.newBufferedWriter(outfile, false);

        for (int i = 0; i < tcList.size(); i++) {
            TestCase tc = tcList.get(i);
            Object solution = tc.getSolution();
            String line = "Case #" + (i + 1) + ": " + solution.toString();
            Utils.writeLn(bw, line);
        }

        Utils.closeBw(bw);

    }
}
