【題解】Codeforces 1301A. Three Strings

【題目敘述】https://codeforces.com/contest/1301/problem/A

#include <iostream>
using namespace std;
 
int t, l;
string a, b, c;
bool flag;
 
int main() {
    cin >> t;
    while (t--){
        cin >> a >> b >> c;
        l = a.length();
        flag = true;
        for (int i = 0; i < l; i++){
            if (a[i]==c[i] || b[i]==c[i]) continue;
            flag = false;
        }
        if (flag) cout << "YES\n";
        else cout << "NO\n";
    }
}
分享本文 Share with friends