#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */

/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, ...);
long strlen(char *);
int main(void) {
  long int t;
  char lone[200002], ltwo[200002];
  scanf("%ld", &t);
  while (t--) {
    long int count = 0, j = 1, index = -1, index1 = -1, m, n, i;
    int flag = 0;
    scanf("%s", lone);
    scanf("%s", ltwo);
    n = strlen(lone);
    m = strlen(ltwo);
    for (i = 0; i < m; i++) {
      if (lone[i] == '#') {
        index = i;
        break;
      }
    }
    for (i = 0; i < m; i++) {
      if (ltwo[i] == '#') {
        index1 = i;
        break;
      }
    }
    if (index == -1 || index1 == -1) {
      count = 0;
    } else {
      if (index < index1)
        j = 2;
      for (i = 0; i < m; i++) {
        if (lone[i] == '#' && ltwo[i] == '#') {
          flag++;
          break;
        } else {
          if (j == 1) {
            if (lone[i] == '#') {
              j = 2;
              count++;
            }
          } else if (ltwo[i] == '#') {
            count++;
            j = 1;
          }
        }
      }
    }
    if (flag != 0)
      printf("No\n");
    else {
      printf("Yes\n");
      printf("%ld\n", count);
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x61af0,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeb7(%rip),%rdi
lea    -0x10(%rbp),%rsi
mov    $0x0,%al
call   1050 <scanf@plt>
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0xffffffffffffffff,%rcx
mov    %rcx,-0x10(%rbp)
cmp    $0x0,%rax
je     145d <main+0x32d>
movq   $0x0,-0x61ab8(%rbp)
movq   $0x1,-0x61ac0(%rbp)
movq   $0xffffffffffffffff,-0x61ac8(%rbp)
ff ff ff ff
movq   $0xffffffffffffffff,-0x61ad0(%rbp)
ff ff ff ff
movl   $0x0,-0x61aec(%rbp)
lea    -0x30d60(%rbp),%rsi
lea    0xe53(%rip),%rdi
mov    $0x0,%al
call   1050 <scanf@plt>
lea    -0x61ab0(%rbp),%rsi
lea    0xe3e(%rip),%rdi
mov    $0x0,%al
call   1050 <scanf@plt>
lea    -0x30d60(%rbp),%rdi
call   1030 <strlen@plt>
mov    %rax,-0x61ae0(%rbp)
lea    -0x61ab0(%rbp),%rdi
call   1030 <strlen@plt>
mov    %rax,-0x61ad8(%rbp)
movq   $0x0,-0x61ae8(%rbp)
mov    -0x61ae8(%rbp),%rax
cmp    -0x61ad8(%rbp),%rax
jge    1259 <main+0x129>
mov    -0x61ae8(%rbp),%rax
movsbl -0x30d60(%rbp,%rax,1),%eax
ff
cmp    $0x23,%eax
jne    123d <main+0x10d>
mov    -0x61ae8(%rbp),%rax
mov    %rax,-0x61ac8(%rbp)
jmp    1259 <main+0x129>
jmp    1242 <main+0x112>
mov    -0x61ae8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x61ae8(%rbp)
jmp    11fe <main+0xce>
movq   $0x0,-0x61ae8(%rbp)
mov    -0x61ae8(%rbp),%rax
cmp    -0x61ad8(%rbp),%rax
jge    12bf <main+0x18f>
mov    -0x61ae8(%rbp),%rax
movsbl -0x61ab0(%rbp,%rax,1),%eax
ff
cmp    $0x23,%eax
jne    12a3 <main+0x173>
mov    -0x61ae8(%rbp),%rax
mov    %rax,-0x61ad0(%rbp)
jmp    12bf <main+0x18f>
jmp    12a8 <main+0x178>
mov    -0x61ae8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x61ae8(%rbp)
jmp    1264 <main+0x134>
cmpq   $0xffffffffffffffff,-0x61ac8(%rbp)
ff
je     12db <main+0x1ab>
cmpq   $0xffffffffffffffff,-0x61ad0(%rbp)
ff
jne    12eb <main+0x1bb>
movq   $0x0,-0x61ab8(%rbp)
jmp    1415 <main+0x2e5>
mov    -0x61ac8(%rbp),%rax
cmp    -0x61ad0(%rbp),%rax
jge    130a <main+0x1da>
movq   $0x2,-0x61ac0(%rbp)
movq   $0x0,-0x61ae8(%rbp)
mov    -0x61ae8(%rbp),%rax
cmp    -0x61ad8(%rbp),%rax
jge    1410 <main+0x2e0>
mov    -0x61ae8(%rbp),%rax
movsbl -0x30d60(%rbp,%rax,1),%eax
ff
cmp    $0x23,%eax
jne    136d <main+0x23d>
mov    -0x61ae8(%rbp),%rax
movsbl -0x61ab0(%rbp,%rax,1),%eax
ff
cmp    $0x23,%eax
jne    136d <main+0x23d>
mov    -0x61aec(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x61aec(%rbp)
jmp    1410 <main+0x2e0>
cmpq   $0x1,-0x61ac0(%rbp)
01
jne    13b5 <main+0x285>
mov    -0x61ae8(%rbp),%rax
movsbl -0x30d60(%rbp,%rax,1),%eax
ff
cmp    $0x23,%eax
jne    13b0 <main+0x280>
movq   $0x2,-0x61ac0(%rbp)
mov    -0x61ab8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x61ab8(%rbp)
jmp    13ef <main+0x2bf>
mov    -0x61ae8(%rbp),%rax
movsbl -0x61ab0(%rbp,%rax,1),%eax
ff
cmp    $0x23,%eax
jne    13ea <main+0x2ba>
mov    -0x61ab8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x61ab8(%rbp)
movq   $0x1,-0x61ac0(%rbp)
jmp    13ef <main+0x2bf>
jmp    13f4 <main+0x2c4>
jmp    13f9 <main+0x2c9>
mov    -0x61ae8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x61ae8(%rbp)
jmp    1315 <main+0x1e5>
jmp    1415 <main+0x2e5>
cmpl   $0x0,-0x61aec(%rbp)
je     1435 <main+0x305>
lea    0xbde(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    1458 <main+0x328>
lea    0xbcf(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x61ab8(%rbp),%rsi
lea    0xbbf(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    1154 <main+0x24>
xor    %eax,%eax
add    $0x61af0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x61aa8,%rsp
lea    0xea8(%rip),%rdi
lea    0x8(%rsp),%rsi
xor    %eax,%eax
call   1060 <scanf@plt>
subq   $0x1,0x8(%rsp)
jb     12c8 <main+0x188>
lea    0xe8d(%rip),%r15
lea    0x30d60(%rsp),%r14
lea    0x10(%rsp),%r13
lea    0xe7c(%rip),%rbp
jmp    11b0 <main+0x70>
lea    0xe7c(%rip),%rdi
call   1030 <puts@plt>
subq   $0x1,0x8(%rsp)
jb     12c8 <main+0x188>
cs nopw 0x0(%rax,%rax,1)
nop
mov    %r15,%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1060 <scanf@plt>
mov    %r15,%rdi
mov    %r13,%rsi
xor    %eax,%eax
call   1060 <scanf@plt>
mov    %r13,%rdi
call   1040 <strlen@plt>
test   %rax,%rax
jle    12a0 <main+0x160>
xor    %ecx,%ecx
nopl   (%rax)
cmpb   $0x23,0x30d60(%rsp,%rcx,1)
23
je     11fa <main+0xba>
add    $0x1,%rcx
cmp    %rcx,%rax
jne    11e0 <main+0xa0>
mov    $0xffffffffffffffff,%rcx
test   %rax,%rax
jle    12a0 <main+0x160>
xor    %esi,%esi
cs nopw 0x0(%rax,%rax,1)
nop
cmpb   $0x23,0x10(%rsp,%rsi,1)
je     1222 <main+0xe2>
add    $0x1,%rsi
cmp    %rsi,%rax
jne    1210 <main+0xd0>
jmp    12a0 <main+0x160>
cmp    $0xffffffffffffffff,%rcx
je     12a0 <main+0x160>
xor    %edx,%edx
cmp    %rsi,%rcx
setl   %dl
add    $0x1,%rdx
xor    %ecx,%ecx
xor    %r12d,%r12d
jmp    1263 <main+0x123>
nopl   0x0(%rax,%rax,1)
xor    %esi,%esi
cmpb   $0x23,0x10(%rsp,%rcx,1)
sete   %sil
mov    $0x2,%edx
sub    %rsi,%rdx
movzbl %sil,%esi
add    %rsi,%r12
add    $0x1,%rcx
cmp    %rcx,%rax
je     12a3 <main+0x163>
movzbl 0x30d60(%rsp,%rcx,1),%ebx
cmp    $0x23,%bl
sete   %sil
jne    127f <main+0x13f>
cmpb   $0x23,0x10(%rsp,%rcx,1)
je     118d <main+0x4d>
cmp    $0x1,%rdx
jne    1240 <main+0x100>
xor    %edx,%edx
cmp    $0x23,%bl
sete   %dl
add    $0x1,%rdx
jmp    1253 <main+0x113>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
xor    %r12d,%r12d
lea    0xd62(%rip),%rdi
call   1030 <puts@plt>
mov    %rbp,%rdi
mov    %r12,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
subq   $0x1,0x8(%rsp)
jae    11b0 <main+0x70>
xor    %eax,%eax
add    $0x61aa8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%ld\00"
@.str.1 = [3 x i8] c"%s\00"
@.str.2 = [4 x i8] c"No\0A\00"
@.str.3 = [5 x i8] c"Yes\0A\00"
@.str.4 = [5 x i8] c"%ld\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i64
%3 = alloca [200002 x i8]
%4 = alloca [200002 x i8]
%5 = alloca i64
%6 = alloca i64
%7 = alloca i64
%8 = alloca i64
%9 = alloca i64
%10 = alloca i64
%11 = alloca i64
%12 = alloca i32
store i32 0, i32* %1
%13 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i64* %2)
br label %14
14: ; preds = %130, %0
%15 = load i64, i64* %2
%16 = add nsw i64 %15, -1
store i64 %16, i64* %2
%17 = icmp ne i64 %15, 0
br i1 %17, label %18, label %131
18: ; preds = %14
store i64 0, i64* %5
store i64 1, i64* %6
store i64 -1, i64* %7
store i64 -1, i64* %8
store i32 0, i32* %12
%19 = getelementptr inbounds [200002 x i8], [200002 x i8]* %3, i64 0, i64 0
%20 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %19)
%21 = getelementptr inbounds [200002 x i8], [200002 x i8]* %4, i64 0, i64 0
%22 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %21)
%23 = getelementptr inbounds [200002 x i8], [200002 x i8]* %3, i64 0, i64 0
%24 = call i64 @strlen(i8* %23)
store i64 %24, i64* %10
%25 = getelementptr inbounds [200002 x i8], [200002 x i8]* %4, i64 0, i64 0
%26 = call i64 @strlen(i8* %25)
store i64 %26, i64* %9
store i64 0, i64* %11
br label %27
27: ; preds = %40, %18
%28 = load i64, i64* %11
%29 = load i64, i64* %9
%30 = icmp slt i64 %28, %29
br i1 %30, label %31, label %43
31: ; preds = %27
%32 = load i64, i64* %11
%33 = getelementptr inbounds [200002 x i8], [200002 x i8]* %3, i64 0, i64 %32
%34 = load i8, i8* %33
%35 = sext i8 %34 to i32
%36 = icmp eq i32 %35, 35
br i1 %36, label %37, label %39
37: ; preds = %31
%38 = load i64, i64* %11
store i64 %38, i64* %7
br label %43
39: ; preds = %31
br label %40
40: ; preds = %39
%41 = load i64, i64* %11
%42 = add nsw i64 %41, 1
store i64 %42, i64* %11
br label %27
43: ; preds = %37, %27
store i64 0, i64* %11
br label %44
44: ; preds = %57, %43
%45 = load i64, i64* %11
%46 = load i64, i64* %9
%47 = icmp slt i64 %45, %46
br i1 %47, label %48, label %60
48: ; preds = %44
%49 = load i64, i64* %11
%50 = getelementptr inbounds [200002 x i8], [200002 x i8]* %4, i64 0, i64 %49
%51 = load i8, i8* %50
%52 = sext i8 %51 to i32
%53 = icmp eq i32 %52, 35
br i1 %53, label %54, label %56
54: ; preds = %48
%55 = load i64, i64* %11
store i64 %55, i64* %8
br label %60
56: ; preds = %48
br label %57
57: ; preds = %56
%58 = load i64, i64* %11
%59 = add nsw i64 %58, 1
store i64 %59, i64* %11
br label %44
60: ; preds = %54, %44
%61 = load i64, i64* %7
%62 = icmp eq i64 %61, -1
br i1 %62, label %66, label %63
63: ; preds = %60
%64 = load i64, i64* %8
%65 = icmp eq i64 %64, -1
br i1 %65, label %66, label %67
66: ; preds = %63, %60
store i64 0, i64* %5
br label %121
67: ; preds = %63
%68 = load i64, i64* %7
%69 = load i64, i64* %8
%70 = icmp slt i64 %68, %69
br i1 %70, label %71, label %72
71: ; preds = %67
store i64 2, i64* %6
br label %72
72: ; preds = %71, %67
store i64 0, i64* %11
br label %73
73: ; preds = %117, %72
%74 = load i64, i64* %11
%75 = load i64, i64* %9
%76 = icmp slt i64 %74, %75
br i1 %76, label %77, label %120
77: ; preds = %73
%78 = load i64, i64* %11
%79 = getelementptr inbounds [200002 x i8], [200002 x i8]* %3, i64 0, i64 %78
%80 = load i8, i8* %79
%81 = sext i8 %80 to i32
%82 = icmp eq i32 %81, 35
br i1 %82, label %83, label %92
83: ; preds = %77
%84 = load i64, i64* %11
%85 = getelementptr inbounds [200002 x i8], [200002 x i8]* %4, i64 0, i64 %84
%86 = load i8, i8* %85
%87 = sext i8 %86 to i32
%88 = icmp eq i32 %87, 35
br i1 %88, label %89, label %92
89: ; preds = %83
%90 = load i32, i32* %12
%91 = add nsw i32 %90, 1
store i32 %91, i32* %12
br label %120
92: ; preds = %83, %77
%93 = load i64, i64* %6
%94 = icmp eq i64 %93, 1
br i1 %94, label %95, label %105
95: ; preds = %92
%96 = load i64, i64* %11
%97 = getelementptr inbounds [200002 x i8], [200002 x i8]* %3, i64 0, i64 %96
%98 = load i8, i8* %97
%99 = sext i8 %98 to i32
%100 = icmp eq i32 %99, 35
br i1 %100, label %101, label %104
101: ; preds = %95
store i64 2, i64* %6
%102 = load i64, i64* %5
%103 = add nsw i64 %102, 1
store i64 %103, i64* %5
br label %104
104: ; preds = %101, %95
br label %115
105: ; preds = %92
%106 = load i64, i64* %11
%107 = getelementptr inbounds [200002 x i8], [200002 x i8]* %4, i64 0, i64 %106
%108 = load i8, i8* %107
%109 = sext i8 %108 to i32
%110 = icmp eq i32 %109, 35
br i1 %110, label %111, label %114
111: ; preds = %105
%112 = load i64, i64* %5
%113 = add nsw i64 %112, 1
store i64 %113, i64* %5
store i64 1, i64* %6
br label %114
114: ; preds = %111, %105
br label %115
115: ; preds = %114, %104
br label %116
116: ; preds = %115
br label %117
117: ; preds = %116
%118 = load i64, i64* %11
%119 = add nsw i64 %118, 1
store i64 %119, i64* %11
br label %73
120: ; preds = %89, %73
br label %121
121: ; preds = %120, %66
%122 = load i32, i32* %12
%123 = icmp ne i32 %122, 0
br i1 %123, label %124, label %126
124: ; preds = %121
%125 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0))
br label %130
126: ; preds = %121
%127 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0))
%128 = load i64, i64* %5
%129 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0), i64 %128)
br label %130
130: ; preds = %126, %124
br label %14
131: ; preds = %14
ret i32 0
}

LLVM IR (-O2):
@.str = [4 x i8] c"%ld\00"
@.str.1 = [3 x i8] c"%s\00"
@.str.4 = [5 x i8] c"%ld\0A\00"
@str = [4 x i8] c"Yes\00"
@str.5 = [3 x i8] c"No\00"
define i32 @main() {
%1 = alloca i64
%2 = alloca [200002 x i8]
%3 = alloca [200002 x i8]
%4 = bitcast i64* %1 to i8*
%5 = getelementptr inbounds [200002 x i8], [200002 x i8]* %2, i64 0, i64 0
%6 = getelementptr inbounds [200002 x i8], [200002 x i8]* %3, i64 0, i64 0
%7 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i64* %1)
%8 = load i64, i64* %1
%9 = add nsw i64 %8, -1
store i64 %9, i64* %1
%10 = icmp eq i64 %8, 0
br i1 %10, label %76, label %11
11: ; preds = %0, %72
%12 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %5)
%13 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %6)
%14 = call i64 @strlen(i8* %6)
%15 = icmp sgt i64 %14, 0
br i1 %15, label %16, label %68
16: ; preds = %11, %21
%17 = phi i64 [ %22, %21 ], [ 0, %11 ]
%18 = getelementptr inbounds [200002 x i8], [200002 x i8]* %2, i64 0, i64 %17
%19 = load i8, i8* %18
%20 = icmp eq i8 %19, 35
br i1 %20, label %24, label %21
21: ; preds = %16
%22 = add nuw nsw i64 %17, 1
%23 = icmp eq i64 %22, %14
br i1 %23, label %24, label %16
24: ; preds = %21, %16
%25 = phi i64 [ -1, %21 ], [ %17, %16 ]
br i1 %15, label %26, label %68
26: ; preds = %24, %31
%27 = phi i64 [ %32, %31 ], [ 0, %24 ]
%28 = getelementptr inbounds [200002 x i8], [200002 x i8]* %3, i64 0, i64 %27
%29 = load i8, i8* %28
%30 = icmp eq i8 %29, 35
br i1 %30, label %34, label %31
31: ; preds = %26
%32 = add nuw nsw i64 %27, 1
%33 = icmp eq i64 %32, %14
br i1 %33, label %68, label %26
34: ; preds = %26
%35 = icmp eq i64 %25, -1
br i1 %35, label %68, label %36
36: ; preds = %34
%37 = icmp slt i64 %25, %27
%38 = select i1 %37, i64 2, i64 1
br label %39
39: ; preds = %36, %59
%40 = phi i64 [ %64, %59 ], [ 0, %36 ]
%41 = phi i64 [ %63, %59 ], [ 0, %36 ]
%42 = phi i64 [ %60, %59 ], [ %38, %36 ]
%43 = getelementptr inbounds [200002 x i8], [200002 x i8]* %2, i64 0, i64 %40
%44 = load i8, i8* %43
%45 = icmp eq i8 %44, 35
br i1 %45, label %46, label %50
46: ; preds = %39
%47 = getelementptr inbounds [200002 x i8], [200002 x i8]* %3, i64 0, i64 %40
%48 = load i8, i8* %47
%49 = icmp eq i8 %48, 35
br i1 %49, label %66, label %50
50: ; preds = %46, %39
%51 = icmp eq i64 %42, 1
br i1 %51, label %52, label %54
52: ; preds = %50
%53 = select i1 %45, i64 2, i64 1
br label %59
54: ; preds = %50
%55 = getelementptr inbounds [200002 x i8], [200002 x i8]* %3, i64 0, i64 %40
%56 = load i8, i8* %55
%57 = icmp eq i8 %56, 35
%58 = select i1 %57, i64 1, i64 2
br label %59
59: ; preds = %54, %52
%60 = phi i64 [ %53, %52 ], [ %58, %54 ]
%61 = phi i1 [ %45, %52 ], [ %57, %54 ]
%62 = zext i1 %61 to i64
%63 = add nuw nsw i64 %41, %62
%64 = add nuw nsw i64 %40, 1
%65 = icmp eq i64 %64, %14
br i1 %65, label %68, label %39
66: ; preds = %46
%67 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @str.5, i64 0, i64 0))
br label %72
68: ; preds = %31, %59, %11, %24, %34
%69 = phi i64 [ 0, %34 ], [ 0, %24 ], [ 0, %11 ], [ %63, %59 ], [ 0, %31 ]
%70 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @str, i64 0, i64 0))
%71 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0), i64 %69)
br label %72
72: ; preds = %68, %66
%73 = load i64, i64* %1
%74 = add nsw i64 %73, -1
store i64 %74, i64* %1
%75 = icmp eq i64 %73, 0
br i1 %75, label %76, label %11
76: ; preds = %72, %0
ret i32 0
}