{"problem":{"name":"Antichain of Integer Strings","description":{"content":"A set $A$ of positive integers is said to be **good** when it satisfies the following condition. *   For any two distinct elements $a, b \\in A$, the string representing $a$ in base ten is **not** a s","description_type":"Markdown"},"platform":"AtCoder","limit":{"time_limit":2000,"memory_limit":262144},"difficulty":"None","is_remote":true,"is_sync":true,"sync_url":null,"sign":"agc057_a"},"statements":[{"statement_type":"Markdown","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.\n\n## Constraints\n\n*   $1\\leq T\\leq 10^4$\n*   $1\\leq L\\leq R\\leq 10^{9}$\n\n## Input\n\nInput 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$\n\n[samples]","is_translate":false,"language":"English"}],"meta":{"iden":"agc057_a","tags":[],"sample_group":[["3\n3 8\n3 18\n1 1000","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}$."]],"created_at":"2026-03-03 11:01:14"}}