{"raw_statement":[{"iden":"problem statement","content":"A set $A$ of positive integers is said to be **good** when it satisfies the following condition.\n\n*   For any two distinct elements $a, b \\in A$, the string representing $a$ in base ten is **not** a substring of the string representing $b$ in base ten.\n\nWhat is a substring? A substring of a string is its contiguous subsequence. For example, `1`, `12`, and `23` are substrings of `123`, while `21` and `13` are not.  \n\nYou are given positive integers $L$ and $R$. Find the maximum possible number of elements in a good set $A$ consisting of integers between $L$ and $R$ (inclusive).\nWe will give you $T$ test cases; solve each of them."},{"iden":"constraints","content":"*   $1\\leq T\\leq 10^4$\n*   $1\\leq L\\leq R\\leq 10^{9}$"},{"iden":"input","content":"Input is given from Standard Input in the following format:\n\n$T$\n$\\text{case}_1$\n$\\vdots$\n$\\text{case}_T$\n\nEach case is in the following format:\n\n$L$ $R$"},{"iden":"sample input 1","content":"3\n3 8\n3 18\n1 1000"},{"iden":"sample output 1","content":"6\n10\n900\n\nFor the first two cases, the following are good sets $A$ with the maximum number of elements.\n\n*   Case $1$: $A={3,4,5,6,7,8}$.\n*   Case $2$: $A={3,4,6,8,9,10,11,12,15,17}$."}],"translated_statement":null,"sample_group":[],"show_order":["default"],"formal_statement":null,"simple_statement":null,"has_page_source":true}