题号:NC294485
时间限制:C/C++/Rust/Pascal 1秒,其他语言2秒
空间限制:C/C++/Rust/Pascal 256 M,其他语言512 M
64bit IO Format: %lld
题目描述
You are given two fractions: an original fraction

and a target fraction

.
We define "Strange Simplification" as follows. You can simplify the original fraction by removing one digit from both the numerator and denominator in each step. The operation must satisfy these rules:
-
After removal, neither numerator nor denominator can have leading zeros.
-
The order of remaining digits must be preserved.
-
You must remove exactly one digit from numerator and one digit from denominator in each operation.
-
The removed two digits must be the same.
For example,

can be simplified as

because of

, but cannot be simplified as

(although numerically the two numbers are indeed equal).

cannot be simplified to

because the denominator has one leading zero.
Determine if the original fraction

can be simplified to the target fraction

through one or more such operations (or do nothing).
输入描述:
The first line contains an integer
(
), denoting the number of test cases.
For each test case, input two fractions
formed as
(
). It is guaranteed that any number does not have any leading zero.
输出描述:
For each test case, if
can be simplified as
, print
. Otherwise, print
.
示例1
输入
复制
6
20250517/20250516 7/6
20250517/5557 202017/57
2100/4200 21/42
1002/2004 100/4
31415/926 31415/926
10/100 1/1