Answers for "Chef and the Wildcard Matching codechef solution in c++"

C++
0

Chef and the Wildcard Matching codechef solution in c++

#include<iostream>
#include<string>
using namespace std;

class solution
{
public:
	void solve()
	{
		int cnt = 0;
		string s1, s2;
		cin >> s1 >> s2;
		int n1 = s1.length();
		for (int i = 0; i < n1; i++)
		{
			if (s1[i] == s2[i])
				cnt++;
			else if ((s1[i] == '?' && s2[i] != '?') || (s1[i] != '?' && s2[i] == '?')|| (s1[i] == '?' && s2[i] == '?'))
				cnt++;
		}
		if (cnt == n1)
			cout << "Yes\n";
		else
			cout << "No\n";
	}
};
int main()
{
	solution ss;

	int t;
	cin >> t;
	while (t--)
    {
		ss.solve();
	}

	return 0;
}
Posted by: Guest on March-15-2022

Code answers related to "Chef and the Wildcard Matching codechef solution in c++"

Browse Popular Code Answers by Language