A = input() B = input() if all([a in B for a in A]): print('YES') else: print('NO')