Word Chain
In a word chain, each word must start with the last letter of the previous word. Is the given sequence a valid chain?
Input: one line with words separated by single spaces.
Output: YES or NO.
Constraints:
- 1 to 200 words of lowercase letters
Sample Tests
Input 1
cat tiger rat
Output 1
YES
Input 2
dog fish
Output 2
NO
Discussion (opens after you solve — no spoilers before)
No comments yet.