Codeforces Round #591 (Div. 2, based on Technocup 2020 Elimination Round 1) B

https://codeforces.com/contest/1241/problem/B


 #include <bits/stdc++.h>
using namespace std;
#define LL long long
#define LD long double
#define SC(t,x) static_cast<t>(x)
#define AR(t) vector < t >
#define PIL pair < int, LL >
#define PLI pair < LL, int >
#define MP make_pair
#define PB push_back
#define PF push_front
#define POB pop_back
#define POF pop_front
#define PRF first
#define PRS second
#define INIT(ar,val) memset ( ar, val, sizeof ( ar ) )
#define lp(loop,start,end) for ( int loop = start; loop < end; ++loop )
const int INF = 0x3fffffff;
const int SINF = 0x7fffffff;
const long long LINF = 0x3fffffffffffffff;
const long long SLINF = 0x7fffffffffffffff;
const int MAXN = 107;
int n;
char s[MAXN], t[MAXN];
 
void init ();
void input ();
void work ();
 
 
 
int main ()
{
	init ();
 
	int T;
	scanf ( "%d", &T );
	while ( T-- ) {
		input ();
		work ();
	}
}
 
 
 
void init ()
{
	// Init Everything Here
 
	ios::sync_with_stdio ( false );
}
 
void input ()
{
	// input method
 
	scanf ( "%s%s", s, t );
}
 
void work ()
{
	// main work
 
	n = strlen ( s );
 
	set < char > ss;
	lp ( i, 0, n ) ss.insert ( s[i] );
	lp ( i, 0, n ) {
		if ( ss.find ( t[i] ) != ss.end () ) {
			cout << "YES" << endl;
			return;
		}
	}
	cout << "NO" << endl;
}
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值