AtCoder Beginner Contest 060
翻译中…
Problem Statement
翻译中…
You are given three strings $A$, $B$ and $C$. Check whether they form a word chain.
翻译中…
More formally, determine whether both of the following are true:
翻译中…
- The last character in
$A$and the initial character in$B$are the same. - The last character in
$B$and the initial character in$C$are the same.
翻译中…
If both are true, print YES. Otherwise, print NO.
翻译中…
Constraints
翻译中…
$A$,$B$and$C$are all composed of lowercase English letters (a-z).$1 ≤ |A|, |B|, |C| ≤ 10$, where$|A|$,$|B|$and$|C|$are the lengths of$A$,$B$and$C$, respectively.
翻译中…
Input
翻译中…
Input is given from Standard Input in the following format:
翻译中…
A B C
翻译中…
Output
翻译中…
Print YES or NO.
翻译中…
样例
Input #1
rng gorilla apple
Output #1
YES
They form a word chain.
Input #2
yakiniku unagi sushi
Output #2
NO
$A$ and $B$ form a word chain, but $B$ and $C$ do not.
Input #3
a a a
Output #3
YES
Input #4
aaaaaaaaab aaaaaaaaaa aaaaaaaaab
Output #4
NO
题目信息
题面与样例版权归 AtCoder 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。