#abc060a. [abc060_a]Shiritori
[abc060_a]Shiritori
Problem Statement
You are given three strings , and . Check whether they form a word chain.
More formally, determine whether both of the following are true:
- The last character in and the initial character in are the same.
- The last character in and the initial character in are the same.
If both are true, print YES
. Otherwise, print NO
.
Constraints
- , and are all composed of lowercase English letters (
a
-z
). - , where , and are the lengths of , and , respectively.
Input
Input is given from Standard Input in the following format:
Output
Print YES
or NO
.
Sample Input 1
Sample Output 1
They form a word chain.
Sample Input 2
Sample Output 2
and form a word chain, but and do not.