题目描述
Read problems statements in Mandarin Chinese and Russian.
Chef likes to play games a lot. Gravity Guy is one such interesting game.
"Gravity Guy is an arcade side-scrolling game in which the player controls Gravity Guy by tapping the screen to switch gravity. The objective in this game is to run as far as possible while avoiding being trapped by obstacles, falling, or flying off the screen. If hit by obstacles, the game is over."
Chef is so addicted to this game that each night he dreams of himself being in the game as Gravity Guy. He has two lanes in front of him represented by two strings of equal length named as L_{1} and L_{2}. Each of the two lanes consists of some clean blocks represented by '.' and some dirty blocks represented by '#'.
Chef can start running from the beginning of any of the two lanes and cannot step over any dirty block ( '#' ) encountered during his journey. He has to complete his journey by reaching the end block of any of the two lanes.
Chef can use the following jumps to reach his destination. Considering chef is at x^{th} block of some lane.
He can jump to x+1^{th} block of the same lane.
He can switch gravity quickly and jump to x^{th} block of the other lane.
He can switch gravity and jump to x+1^{th} block of the other lane.
You have to tell him whether he can reach his destination or not. If it is possible for him to reach his destination, then Chef is interested in knowing the minimum number of gravity switches required to reach the destination.
------ Input ------
First line of input contains a single integer T denoting the number of test cases. Each test case consists of 2 lines. First line of each test case contains a string denoting lane L_{1}. Second line of each test case contains a string denoting lane L_{2}.
------ Output ------
For each test case, print "Yes" (without quotes) in the first line if Chef is able to reach the destination followed by a line containing an integer denoting minimum number of gravity switches required to reach to the destination. Print a single line containing the word "No" (without quotes) otherwise.
------ Constraints ------
$1 ≤ T ≤ 10^{5}$
$1 ≤ |L_{1}| ≤ 2 × 10^{5}, where |S| denotes the length of string S$
$|L_{1}| = |L_{2}|$
------ Subtasks ------
Subtask 1 (25 points)
$Sum of |L_{1}| over all test cases in one file it at most 200.$
$Only "Yes"/"No" response will be evaluated.$
Subtask 2 (25 points)
$Sum of |L_{1}| over all test cases in one file it at most 200.$
Subtask 3 (25 points)
$Sum of |L_{1}| over all test cases in one file it at most 10^{6}.$
$Only "Yes"/"No" response will be evaluated.$
Subtask 4 (25 points)
$Sum of |L_{1}| over all test cases in one file it at most 10^{6}.$
----- Sample Input 1 ------
3
...
.###.
.#.#.
.#.#.#
...
...
----- Sample Output 1 ------
Yes
2
Yes
5
No
----- explanation 1 ------
Test case $1$: Chef will start his journey from $L_{2}$. He switches gravity and jumps to $L_{1}$. He continues on $L_{1}$ till block $4$ and then again switch gravity and jump to block $5$ of $L_{2}$. Therefore, he requires total $2$ gravity switches to reach the destination.
Test case $2$: Chef will start his journey from $L_{2}$. He switches gravity and jumps to second block of $L_{1}$. He switches gravity and jumps to third block of $L_{2}$. He switches gravity and jumps to fourth block of $L_{1}$. He switches gravity and jumps to fifth block of $L_{2}$. He switches gravity and jumps to sixth block of $L_{1}$. Therefore, he requires total $5$ gravity switches to reach the destination.
Test case $3$: Chef cannot start his journey as starting block of both the lanes $L_{1}$ and $L_{2}$ are dirty and he cannot step over them.
输入格式
见题面
输出格式
见题面