-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathb.cpp
71 lines (61 loc) · 986 Bytes
/
b.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <vector>
#include <fstream> // make obj and use it
#include <utility>
#include <cstring>
using namespace std;
int main()
{
int t;
cin>>t;
while(t--)
{
char L[2][500005];
cin>>L[0];
cin>>L[1];
//cout<<L[1]<<L[0]<<endl;
int len=strlen(L[0]);
bool b=true;
for(int i=0;i<len;i++){
if(L[0][i]=='#' and L[1][i]=='#')
b=false;
}
if(!b){
cout<<"No\n";
continue;
}
int ans=0;
int pos=0;
int a_len=0;
int b_len=0;
for(int i=0;i<len;i++){
if(L[0][i]=='.')
a_len++;
else
break;
}
for(int i=0;i<len;i++){
if(L[1][i]=='.')
b_len++;
else
break;
}
// cout<<a_len<<" "<<b_len<<" "<<len<<" sfsf"<<endl;
if(a_len<b_len)
pos=1;
for(int i=0;i<len-1;i++){
if(L[pos][i+1]=='#')
{
//cout<<"pos "<<pos<<endl;
pos=1-pos;
ans++;
}
}
cout<<"Yes\n";
cout<<ans<<endl;
}
return 0;
}