A = input() B = input() ans = '' for i in A: if i not in B: print('NO') break else: ans = ans + str(i) if ans == A: print('YES')