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