Source Code
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;


void magic() {  
    int n; cin>>n;
    vector <char> a,t;
    for(int i= 0 ; i<n ; i++){
        char x; cin>>x;
        if (x!='.') a.push_back(x);
    }
    int checking = 0;
    bool ok = true;
    for(int i= 0 ; i<n ; i++){
        char x; cin>>x;
        if(x!='.'){
            if(x != a[checking]) ok = false;
            checking ++;
        }
    }
    if(ok) cout<<"yes\n";
    else cout<<"no\n";
}


int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    //freopen("intput.in", "r", stdin); // INPUT
    // freopen("road.out", "w", stdout); // OUTPUT JUST IN CASE

    int tt = 1; cin>>tt;
    while (tt--)
        magic();
}
Copy
Moving Digits hashemtb
GNU G++17
1 ms
328 KB
Runtime Error
Test Case #1
1 ms
184 KB
Accepted
Input
4
3
2.3
23.
3
2.5
23.
9
012..3.1.
01..231..
9
012..301.
01..23..1
Output
yes
no
yes
no
Judge Output
yes
no
yes
no
Checker Message
4 token(s): yes count is 2, no count is 2
Test Case #2
1 ms
328 KB
Runtime Error
Input
250
1
.
.
1
0
0
1
1
1
1
3
.
1
.
5
1
2
.
1
.
4
1
7
6
1
8
9
91
4305439443638641612640553448743028136108425373594244994772706266127990382491256106626714309
4305439443638641612640553448743028136108425373594244994772706266127990382491256106626714309
58
6...
Output

Judge Output
yes
yes
yes
no
no
no
no
no
no
yes
no
no
no
yes
yes
no
no
no
no
no
yes
yes
yes
no
yes
no
yes
yes
yes
yes
no
no
yes
no
yes
yes
yes
yes
no
yes
no
yes
yes
yes
no
no
yes
no
yes
yes
no
no
no
no
no
no
yes
no
no
yes
no
yes
yes
yes
yes
yes
no
yes
yes
yes
no
...
Checker Message