#K46022. Palindromic Number Search

    ID: 27884 Type: Default 1000ms 256MiB

Palindromic Number Search

In this problem, you are given a range ([A, B]). A number is called palindromic if it reads the same backward as forward (for instance, 121 or 22). Your task is to find the largest palindromic number within the given range. Additionally, you need to handle multiple test cases. For each test case, output the largest palindromic number in the range. This problem tests basic looping and string manipulation skills.

inputFormat

The first line contains an integer T indicating the number of test cases. Each of the following T lines contains two space-separated integers A and B representing the inclusive range.

outputFormat

For each test case, output a single line containing the largest palindromic number in the range [A, B].## sample

2
10 50
120 130
44

121

</p>