Shiritori

AtCoder
IDabc060_a
Time2000ms
Memory256MB
Difficulty
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$ [samples]
Samples
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
API Response (JSON)
{
  "problem": {
    "name": "Shiritori",
    "description": {
      "content": "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 ch",
      "description_type": "Markdown"
    },
    "platform": "AtCoder",
    "limit": {
      "time_limit": 2000,
      "memory_limit": 262144
    },
    "difficulty": "None",
    "is_remote": true,
    "is_sync": true,
    "sync_url": null,
    "sign": "abc060_a"
  },
  "statements": [
    {
      "statement_type": "Markdown",
      "content": "You are given three strings $A$, $B$ and $C$. Check whether they form a _word chain_.\nMore formally, determine whether both of the following are true:\n\n*   The last character in $A$ and the initial ch...",
      "is_translate": false,
      "language": "English"
    }
  ]
}
Full JSON Raw Segments