1301A. Three Strings - Codeforces Solution C++

  Problem Link : 1301A. Three Strings 


✅ C++ Solution :

 
#include<bits/stdc++.h>
using namespace std;

#define ll long long int

int main()
{
	int t;
	cin>>t;
	while(t--)
	{
		string a,b,c;
		cin>>a>>b>>c;

		bool flag=1;
		for(int i=0;i<a.length();i++)
		{
			char p=c[i];
			if(p!=a[i] && p!=b[i])
			{
				flag=0;
				break;
			}
		}
		if(flag)
			cout<<"YES\n";
		else
			cout<<"NO\n";

	}

}

 

Thank you for your patience reading. If you enjoyed this post, I’d be very grateful if you’d help it spread by emailing it to a friend, or sharing it on Whatsapp or Facebook. 

😇Happy Learning!!