Codeforces 1097A Gennady and a Card Game

#define _CRT_SECURE_NO_WARNINGS
#include 
#include 
#include 
#include 
#include 

using namespace std;

int main() {
	char s1[20];
	char s2[20];
	cin.getline(s1, 20, '\n');
	cin.getline(s2, 20, '\n');
	bool flag = false;
	for (int i = 0;i < 5;++i) {
		if (s2[i * 3] == s1[0]) {
			flag = true;
			break;
		}
	}
	for (int i = 0;i < 5;++i) {
		if (s2[(i * 3)+1] == s1[1]) {
			flag = true;
			break;
		}
	}
	if (flag) {
		cout << "YES" << endl;
	}
	else {
		cout << "NO" << endl;
	}
	//system("pause");
	return 0;
}

 

你可能感兴趣的:(ACM)