Problem:


Score : 100 points

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.

Sample Input 1

rng gorilla apple

Sample Output 1

YES

They form a word chain.

Sample Input 2

yakiniku unagi sushi

Sample Output 2

NO

A and B form a word chain, but B and C do not.

Sample Input 3

a a a

Sample Output 3

YES

Sample Input 4

aaaaaaaaab aaaaaaaaaa aaaaaaaaab

Sample Output 4

NO



Sample input:
rng gorilla apple


Sample output:
YES

Submission status: Accepted

Solution code:
A,B,C=input().split()
print("YES") if A[-1]==B[0] and B[-1]==C[0] else print("NO")

Submission status: Accepted

Solution code:
a,b,c=input().split()
print('YES') if a[-1]==b[0] and b[-1]==c[0] else print('NO')

Submission status: Accepted

Solution code:
a, b, c = input().split()
if a[-1]==b[0] and b[-1]==c[0]:
    print("YES")
else:
    print("NO")

Submission status: Accepted

Solution code:
A,B,C=map(str,input().split())
#print(sorted(B)[0])
if A[::-1][0]==B[0] and B[::-1][0]==C[0]:
    print('YES')
else:
    print('NO')

Submission status: Accepted

Solution code:
def main():
    A, B, C = input().split()
    print("YES" if A[-1] == B[0] and B[-1] == C[0] else "NO")


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
a,b,c = input().split()
print("YES" if a[len(a)-1]==b[0] and b[len(b)-1]==c[0] else "NO")

Submission status: Accepted

Solution code:
S = input().split()

if S[0][len(S[0]) - 1] == S[1][0] and S[1][len(S[1]) - 1] == S[2][0]:
  print('YES')
else:
  print('NO')

Submission status: Accepted

Solution code:
a,b,c = map(str,input().split())
count = 0
if a[-1] == b[0]:
    count += 1
if b[-1] == c[0]:
    count += 1
if count ==2:
    print('YES')
else:
    print("NO")

Submission status: Accepted

Solution code:
A,B,C=map(str,input().split())
if A[-1]==B[0] and B[-1]==C[0]:
	print("YES")
else:
	print("NO")

Submission status: Accepted

Solution code:
a, b, c = input().split()
print('YES') if a[-1]==b[0] and b[-1]==c[0] else print('NO')

Submission status: Accepted

Solution code:
a, b, c = input().split()

if a[-1] == b[0] and b[-1] == c[0]:
  print ('YES')
else:
  print('NO')

Submission status: Accepted

Solution code:
A, B, C = input().split()
if A[-1] == B[0] and B[-1] == C[0]:
  print('YES')
else:
  print('NO')

Submission status: Accepted

Solution code:
a, b, c = map(str, input().split())

if a[-1] == b[0] and b[-1] == c[0]:
  print('YES')
else:
  print('NO')

Submission status: Accepted

Solution code:
A,B,C = input().split()

if A[-1]==B[0] and B[-1]==C[0]:
  print("YES")
else:
  print("NO")

Submission status: Accepted

Solution code:
a,b,c=input().split()
if a[-1]==b[0] and b[-1]==c[0]:
    print("YES")
else:
    print("NO")

Submission status: Accepted

Solution code:
#ABC060 

a,b,c = input().split()
if a[len(a)-1] == b[0] and b[len(b)-1] == c[0]:
    print("YES")
else:
    print("NO")

Submission status: Accepted

Solution code:
a,b,c = map(str,input().split())
print("YES" if a[-1] == b[0] and b[-1] == c[0] else "NO")

Submission status: Accepted

Solution code:
a,b,c = map(str,input().split())
print("YES" if a[-1] == b[0] and b[-1] == c[0] else "NO")

Submission status: Accepted

Solution code:
a,b,c = map(str,input().split())
if a[-1] == b[0] and b[-1] == c[0] :
  print("YES")
else : 
  print("NO")

Submission status: Accepted

Solution code:
a,b,c=input().split()

if a[len(a)-1]==b[0] and b[len(b)-1]==c[0]:
    print('YES')
else:
    print('NO')

Submission status: Accepted

Solution code:
a, b, c = input().split()
print("YES" if a[-1] == b[0] and b[-1] == c[0] else "NO" )

Submission status: Accepted

Solution code:
A, B, C = input().split()


if A[-1] == B[0] and B[-1] == C[0]:
    print("YES")
else:
    print("NO")

Submission status: Accepted

Solution code:
A,B,C=map(str,input().split())
print('YES'if A[int(len(A))-1]==B[0] and B[int(len(B))-1]==C[0] else 'NO')

Submission status: Accepted

Solution code:
a,b,c = input().split()
print('YNEOS'[a[-1]!=b[0] or b[-1]!= c[0]::2])

Submission status: Accepted

Solution code:
A, B, C = input().split()

if A[len(A)-1] == B[0] and B[len(B)-1] == C[0]:
    print("YES")
else:
    print("NO")

Submission status: Accepted

Solution code:
a,b,c=input().split()
print('YES' if a[-1]==b[0] and b[-1]==c[0] else 'NO')

Submission status: Accepted

Solution code:
a,b,c = map(str, input().split())
if a[-1]==b[0] and b[-1]==c[0]: print('YES')
else: print('NO')

Submission status: Accepted

Solution code:
a,b,c = input().split()
print('YNEOS'[a[-1]!=b[0] or b[-1]!=c[0]::2])

Submission status: Accepted

Solution code:
# AtCoder Beginner Contest 060
# A - Shiritori 
A, B, C = map(str, input().split())
if A[len(A)-1] == B[0] and B[len(B)-1] == C[0]:
    print('YES')
else:
    print('NO')

Submission status: Accepted

Solution code:
A,B,C= input().split()
a=str(A)
b=str(B)
c=str(C)
if a[-1]==b[0]:
    if b[-1]==c[0]:
        print("YES")
        exit()
print("NO")

Submission status: Accepted

Solution code:
A,B,C=map(str,input().split())
#print(A,B,C)
if (A[len(A)-1]==B[0])and(B[len(B)-1]==C[0]):
    print("YES")
else:
    print("NO")

Submission status: Accepted

Solution code:
A, B, C = list(map(str, input().split()))
if A[len(A)-1] == B[0] and B[len(B)-1] == C[0]:
    print("YES")
else:
    print("NO")

Submission status: Accepted

Solution code:
A, B, C = input().split()
Answer = 'NO'

if A[-1] == B[0] and B[-1] == C[0]:
  Answer = 'YES'

print(Answer)

Submission status: Accepted

Solution code:
# 入力　文字列3つ
a, b, c = input().split()

# しりとりならYES
if a[-1] == b[0] and b[-1] == c[0] :
    print("YES")
else :
    print("NO")

Submission status: Accepted

Solution code:
a, b, c = input().split()

if a[len(a)-1] == b[0] and b[len(b)-1] == c[0]:
	print("YES")
else:
	print("NO")

Submission status: Accepted

Solution code:
a,b,c=input().split()
if  a[-1] == b[0] and b[-1] == c[0]:
  print('YES')
else:
  print('NO')

Submission status: Accepted

Solution code:
a, b, c = input().split()
if a[len(a)-1]==b[0] and b[len(b)-1]==c[0]:
  print("YES")
else:
  print("NO")

Submission status: Accepted

Solution code:
A, B, C = input().split()
print('YES' if A[-1] == B[0] and B[-1] == C[0] else 'NO')

Submission status: Accepted

Solution code:
def abc(a,b,c):
    
    return "YES" if a[-1] == b[0] and b[-1] == c[0] else "NO"
 
def main():
    a , b , c = map(str, input().split())
    print(abc(a , b , c))
 
if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
a,b,c = input().split()
if a[-1]==b[0] and b[-1]==c[0]:
         print("YES")
else:
    print("NO")

Submission status: Accepted

Solution code:
a = input()
list_a = a.split(" ")
b = [] #リスト作成
for i in range(len(list_a)):
    b.append(list(list_a[i]))
if b[0][-1] == b[1][0] and b[1][-1] == b[2][0]:
    print("YES")
else:
    print("NO")

Submission status: Accepted

Solution code:
A,B,C=map(str,input().split())
if A[-1]==B[0] and B[-1]==C[0]:
  print("YES")
else:
  print("NO")

Submission status: Accepted

Solution code:
a, b, c = tuple(input().split())
if a[-1] == b[0] and b[-1] == c[0]:
    print('YES')
else:
    print('NO')

Submission status: Accepted

Solution code:
a, b, c = map(str, input().split())
if a[len(a) - 1] == b[0] and b[len(b) - 1] == c[0]: print("YES")
else: print("NO")

Submission status: Accepted

Solution code:
a,b,c = map(str, input().split())

if a[-1] == b[0] and b[-1] == c[0]:
  print("YES")
else:
  print("NO")

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
# -*- coding: utf-8 -*-


def main():
    A, B, C = input().split()
    print('YES'if all([A[-1] == B[0], B[-1] == C[0]]) else 'NO')


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
a,b,c = map(str, input().split())
print("YES" if a[-1] == b[0] and b[-1] == c[0] else "NO")

Submission status: Accepted

Solution code:
A,B,C = list(input().split())
if A[-1] == B[0] and B[-1] == C[0]:
    print("YES")
else:
    print("NO")

Submission status: Accepted

Solution code:
a,b,c=list(map(str,input().split()))
if a[-1]==b[0]and b[-1]==c[0]:
    print('YES')
else:
    print('NO')

Submission status: Accepted

Solution code:
a,b,c = map(str,input().split())
ans = 'YES'
if a[-1] != b[0]:
    ans = 'NO'
if b[-1] != c[0]:
    ans = 'NO'
print(ans)

Submission status: Accepted

Solution code:
"""
author : halo2halo
date : 30, Jan, 2020
"""

import sys
import itertools

# import numpy as np

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

A, B, C = readline().decode('utf8').split()

print('YES' if A[-1] == B[0] and B[-1] == C[0] else 'NO')

Submission status: Accepted

Solution code:
a, b, c = map(str, input().split())
print('YES' if a[-1]==b[0] and b[-1]==c[0] else 'NO')

Submission status: Accepted

Solution code:
A, B, C = map(str, input().split())

if A[len(A)-1] == B[0]:
    if B[len(B)-1] == C[0]:
        print("YES")
    else:
        print("NO")
else:
    print("NO")

Submission status: Accepted

Solution code:
A, B, C = input().split()
print("YNEOS"[not(A[-1]==B[0]and B[-1]==C[0])::2])

Submission status: Accepted

Solution code:
list = input().split()
if list[0][-1] == list[1][0] and list[1][-1] == list[2][0]:
    print('YES')
else:
    print('NO')

Submission status: Accepted

Solution code:
A, B, C = input().split()

# 先頭と末尾が同じ文字だったらシリトリになっていると判定する
if A[-1] == B[0] and B[-1] == C[0]:
    print("YES")
else:
    print("NO")

Submission status: Accepted

Solution code:
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd

def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

A, B, C = input().split()

if A[-1] == B[0] and B[-1] == C[0]:
	print("YES")
else:
	print("NO")

Submission status: Accepted

Solution code:
a=[]
b=[]
c=[]
a,b,c=input().split()
if a[-1]==b[0] and b[-1]==c[0]:
    print('YES')
else:
    print('NO')

Submission status: Accepted

Solution code:
A, B, C = map(str, input().split())
if A[-1] == B[0] and B[-1] == C[0]:
    print("YES")
else:
    print("NO")

Submission status: Accepted

Solution code:
a,b,c = map(str,input().split())
if a[-1] == b[0] and b[-1] == c[0] :
  print('YES')
else:
  print('NO')

Submission status: Accepted

Solution code:
def main():
    from sys import stdin, setrecursionlimit
    #setrecursionlimit(10**9)
    #n = int(stdin.readline()[:-1])   
    r = stdin.readline()[:-1]
    #n = int(stdin.readline()[:-1])   
    #r = [stdin.readline() for i in range(n)]
    #t = [int(stdin.readline()) for i in range(n)]
    #a = r.split()
    a, b, c = r.split()
    #a = list(map(int, r.split()))
    #a,b,c = map(int, r.split())
    #a = [int(s[i]) for i in range(1, n+1)]
    #a = [list(map(int, r.split())) for i in range(1,n+1)]
    #res = 0

    if a[-1] == b[0] and b[-1] == c[0]:
        print('YES')
    else:
        print('NO')

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
s1, s2, s3 = map(str, input().split())
if s1[len(s1) - 1] == s2[0] and  s2[len(s2) - 1] == s3[0]:
    print("YES")
else:
    print("NO")

Submission status: Accepted

Solution code:
a,b,c = input().split()

if (a[-1] == b[0]) & (b[-1]==c[0]):
  print("YES")
else:
  print("NO")

Submission status: Accepted

Solution code:
a=list(str(input()).split())
print("YES" if a[0][-1]==a[1][0] and a[1][-1]==a[2][0] else "NO")

Submission status: Accepted

Solution code:
A,B,C = input().split()
if A[-1] == B[0] and B[-1] == C[0] :
    print("YES")
else :
    print("NO")

Submission status: Accepted

Solution code:
a,b,c = input().split()
print("YES" if a[-1]==b[0] and b[-1]==c[0] else "NO")

Submission status: Accepted

Solution code:
import sys

sys.setrecursionlimit(10 ** 6)
int1 = lambda x: int(x) - 1
p2D = lambda x: print(*x, sep="\n")
def II(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]

def main():
    ss=input().split()
    if ss[0][-1]==ss[1][0] and ss[1][-1]==ss[2][0]:print("YES")
    else:print("NO")
main()

Submission status: Accepted

Solution code:
a, b, c = map(format, input().split())

if a[len(a) - 1] == b[0] and b[len(b) - 1] == c[0]:
  print('YES')
else:
  print('NO')

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline
a,b,c=map(str,input().split())
if a[-1]==b[0] and b[-1]==c[0]:
    print("YES")
else:
    print("NO")

Submission status: Accepted

Solution code:
a, b, c = map(str, input().split())

if a[-1] == b[0] and b[-1] == c[0]:
	print("YES")
else:
	print("NO")

Submission status: Accepted

Solution code:
a, b, c = map(str, input().split())

if a[-1]==b[0] and b[-1]==c[0]:
    print('YES')
else:
    print('NO')

Submission status: Accepted

Solution code:
A, B, C = input().split()
if A[-1] == B[0] and B[-1] == C[0]:
  print('YES')
else:
  print('NO')

Submission status: Accepted

Solution code:


import numpy as np
import math

a=input().split()
for i in range(len(a)-1):
    if(a[i][len(a[i])-1]!=a[i+1][0]):
        print("NO")
        exit(0)
print("YES")

Submission status: Accepted

Solution code:
str = input().split()
a, b, c = str

if(a.endswith(b[0]) and b.endswith(c[0])):
    print('YES')
else:
    print('NO')

Submission status: Accepted

Solution code:
sArray = list(input().split())

if sArray[0][-1] == sArray[1][0] and sArray[1][-1] == sArray[2][0]:
  print("YES")
else:
  print("NO")

Submission status: Accepted

Solution code:
a,b,c=input().split()
if a[-1]==b[0] and b[-1]==c[0]:
    print("YES")
else:
    print("NO")

Submission status: Accepted

Solution code:
a,b,c = map(str, input().split())
if a[-1] == b[0] and b[-1] == c[0]:
    print("YES")
else:
    print("NO")

Submission status: Accepted

Solution code:
a,b,c = list(input().split())
if a[-1]==b[0] and b[-1]==c[0]:
    print('YES')
else:
    print('NO')

Submission status: Accepted

Solution code:
a, b, c = input().split()
print("YES" if a[-1] == b[0] and b[-1] == c[0] else "NO")

Submission status: Accepted

Solution code:
s1, s2, s3 = (i for i in input().split())

if s1[-1] == s2[0] and s2[-1] == s3[0]:
  print('YES')
else:
  print('NO')

Submission status: Accepted

Solution code:
a,b,c=input().split()
if a[-1] == b[0] and b[-1] == c[0]:
  print('YES')
else:print('NO')

Submission status: Accepted

Solution code:
A,B,C = input().split()

if A[-1]==B[0] and B[-1]==C[0]:
    print("YES")
else:
    print("NO")

Submission status: Accepted

Solution code:
a, b, c = input().split()
if a[-1:]==b[0] and b[-1:]==c[0]:
    print("YES")
else:
    print("NO")

Submission status: Accepted

Solution code:
a,b,c = input().split()
print("YES" if a[-1] == b[0] and b[-1] == c[0] else "NO")

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline
A, B, C = input().split()
if A[-1] == B[0] and B[-1] == C[0]:
    print("YES")
else:
    print("NO")

Submission status: Accepted

Solution code:
word = input().split()
if word[0][-1] == word[1][0] and word[1][-1] == word[2][0]:
    print('YES')
else:
    print('NO')

Submission status: Accepted

Solution code:
a,b,c=input().split()
print('YES' if a[-1:]==b[:1] and b[-1:]==c[:1] else 'NO')

Submission status: Accepted

Solution code:
a,b,c = map(str,input().split())

if a[-1] == b[0] and b[-1] == c[0]:
    print('YES')
else:
    print('NO')

Submission status: Accepted

Solution code:
a, b, c = map(str, input().split())

if a[-1] == b[0] and b[-1] == c[0]:
    print("YES")
else:
    print("NO")

Submission status: Accepted

Solution code:
a,b,c=input().split()

if a[-1]==b[0] and b[-1]==c[0]:
  print("YES")
else:
  print("NO")

Submission status: Accepted

Solution code:
a, b, c = input().split()

if a[-1] == b[0] and b[-1] == c[0]:
  print("YES")
else:
  print("NO")

Submission status: Accepted

Solution code:
s=input().split()
a=s[0]
b=s[1]
c=s[2]
if a[len(a)-1]==b[0] and b[len(b)-1]==c[0]:
    print('YES')
else:
    print('NO')

Submission status: Accepted

Solution code:
a, b, c = map(str, input().split())
if (a[-1] == b[0] and b[-1] == c[0]):
   print('YES')
else:
   print('NO')

Submission status: Accepted

Solution code:
import math
import queue
import bisect
import heapq
import time
import itertools

mod = int(1e9+7)

def swap(a,b):
    return (b,a)

def gcd(a,b): #最大公約数
    if (a<b):
        a,b = swap(a,b)
    if (b==0):
        return a
    else:
        return gcd(b,a%b)

def lcm(a,b): #最小公倍数
    return a/gcd(a,b)*b

def divisors(a): # 約数列挙
    divisors = []
    for i in range(1,int(a**0.5)+1):
        if a%i==0:
            divisors.append(i)
            if i!=a//i:
                divisors.append(a//i)
    return divisors

def is_prime(a): #素数判定
    if a<2:
        return False
    elif a==2:
        return True
    elif a%2==0:
        return False
    sqrt_num = int(a**0.5)
    for i in range(3,sqrt_num+1,2):
        if a%i==0:
            return False
    return True

def prime_num(a): #素数列挙
    pn = [2]
    for i in range(3,int(a**0.5),2):
        prime = True
        for j in pn:
            if i%j==0:
                prime = False
                break
        if prime:
            pn.append(i)
    return pn

def prime_fact(a): #素因数分解
    sqrt = math.sqrt(a)
    res = []
    i = 2
    if is_prime(a):
        res.append(a)
    else:
        while a!=1:
            while a%i==0:
                res.append(i)
                a //= i
            i += 1
    return res

def main():
    a,b,c = input().split()
    if a[-1]==b[0] and b[-1]==c[0]:
        print("YES")
    else:
        print("NO")
    return

if __name__=='__main__':
    main()

Submission status: Accepted

Solution code:
A,B,C=map(str,input().split())
print('YES' if A[-1]==B[0] and B[-1]==C[0] else'NO')

Submission status: Accepted

Solution code:
a, b, c = map(str, input().split())

if a[-1] == b[0] and b[-1] == c[0]:
    ans = 'YES'
else:
    ans = 'NO'

print(ans)

Submission status: Accepted

Solution code:
s = input().split()
print('YES' if s[0][-1]==s[1][0] and s[1][-1]==s[2][0] else 'NO')

Submission status: Accepted

Solution code:
a,b,c = input().split()
if a[-1]==b[0] and b[-1]==c[0]:
	print("YES")
else:
	print("NO")

Submission status: Accepted

Solution code:
a, b, c = list(input().split())
ans = 'YES' if a[-1] == b[0] and b[-1] == c[0] else 'NO'
print(ans)

Submission status: Accepted

Solution code:
s = input().split()
if s[0][-1]==s[1][0] and s[1][-1]==s[2][0]:
    print("YES")
else:
    print("NO")

Submission status: Accepted

Solution code:
A, B, C = input().split()
if (A[-1] == B[0]) and (B[-1] == C[0]):
  print("YES")
else:
  print("NO")

Submission status: Accepted

Solution code:
a, b, c = map(str, input().split())

print('YES' if a[-1]==b[0] and b[-1]==c[0] else 'NO')

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-S
a,b,c = map(str,input().split())

a = list(a)
b = list(b)
c = list(c)

if a[len(a) - 1] == b[0] and b[len(b) - 1] == c[0]:
    print("YES")
else:
    print("NO")

Submission status: Accepted

Solution code:
import sys

stdin = sys.stdin

ri = lambda: int(rs())
rl = lambda: list(map(int, stdin.readline().split()))
rs = lambda: stdin.readline().rstrip()  # ignore trailing spaces

A, B, C = rs().split()
bool = A[-1] == B[0] and B[-1] == C[0]
print('YES' if bool else 'NO')

Submission status: Accepted

Solution code:
a=list(input().split())
if a[0][-1] == a[1][0] and a[1][-1] == a[2][0]:
  print("YES")
else:
  print("NO")

Submission status: Accepted

Solution code:
import math

a, b, c = input().split()
print("YES" if a[-1] == b[0] and b[-1] == c[0] else "NO")

Submission status: Accepted

Solution code:
import sys

a, b, c = sys.stdin.readline().split()

def main():
    return 'YES' if a[-1] == b[0] and b[-1] == c[0] else 'NO'

if __name__ == '__main__':
    ans = main()
    print(ans)

Submission status: Accepted

Solution code:
import sys

a,b,c = map(str, sys.stdin.readline().split())

if a[len(a)-1] == b[0] and b[len(b)-1] == c[0]:
    print("YES")
else:
    print("NO")

Submission status: Accepted

Solution code:
A, B, C = list(map(str, input().split()))
if A[-1] == B[0] and  B[-1] == C[0] :
  print("YES")
else :
  print("NO")

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
import sys, math, itertools, collections, bisect
input = lambda: sys.stdin.buffer.readline().rstrip().decode('utf-8')
inf = float('inf')
ans = 0 ;count = 0 ;pro = 1

a,b,c=input().split()
if a[-1]==b[0] and b[-1]==c[0]:
    print("YES")
else:
    print("NO")

Submission status: Accepted

Solution code:
info=list(input().split())
a=list(info[0])
b=list(info[1])
c=list(info[2])
if a[-1]==b[0] and b[-1]==c[0]:
    print("YES")
else:
    print("NO")

Submission status: Accepted

Solution code:
A,B,C = list(map(str,input().split()))
ans="NO"
if A[len(A)-1] == B[0] and B[len(B)-1] == C[0]:
  ans = "YES"
print(ans)

Submission status: Accepted

Solution code:
a, b, c = input().split()
if a[-1] == b[0] and b[-1] == c[0]:
	print("YES")
else:
	print("NO")

Submission status: Accepted

Solution code:
A, B, C = map( str, input().split() )
if A[len( A )-1] == B[0] and B[len( B )-1] == C[0] :
   print( "YES" )
else : 
   print( "NO" )

Submission status: Accepted

Solution code:
s=list(input().split())
if s[0][-1]==s[1][0] and s[1][-1]==s[2][0]:
  print("YES")
else:
  print("NO")

Submission status: Accepted

Solution code:
a,b,c=map(str,input().split())
if(a[-1]==b[0])and(b[-1]==c[0]):
    print("YES")
else:
    print("NO")

Submission status: Accepted

Solution code:
#!usr/bin/env python3
from collections import defaultdict,deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def LS():return [list(x) for x in sys.stdin.readline().split()]
def S(): return list(sys.stdin.readline())[:-1]
def IR(n):
    return [I() for i in range(n)]
def LIR(n):
    return [LI() for i in range(n)]
def SR(n):
    return [S() for i in range(n)]
def LSR(n):
    return [LS() for i in range(n)]

sys.setrecursionlimit(1000000)
mod = 1000000007

def solve():
    a,b,c = input().split()
    if a[-1] == b[0] and b[-1] == c[0]:
        print("YES")
    else:
        print("NO")
    return

#Solve
if __name__ == "__main__":
    solve()

Submission status: Accepted

Solution code:
a, b, c = input().split()
if (a[len(a)-1] == b[0]) and (b[len(b)-1] == c[0]):
	print("YES")
else:
	print("NO")

Submission status: Accepted

Solution code:
a, b, c = map(str, input().split())
print('YES' if a[-1] == b[0] and b[-1] == c[0] else 'NO')

Submission status: Accepted

Solution code:
a, b, c = input().split(' ')
if a[-1] == b[0] and b[-1] == c[0]:
    print('YES')
else:
    print('NO')

Submission status: Accepted

Solution code:
a,b,c = input().split()
check = a[-1] == b[0] and b[-1] == c[0]
print('YES' if check else 'NO')

Submission status: Accepted

Solution code:
A,B,C = map(str, input().split())

if A[-1] == B[0] and B[-1] == C[0]:
  print("YES")
else:
  print("NO")

Submission status: Accepted

Solution code:
A, B, C = input().split()
print('YES') if(A[-1] == B[0] and B[-1] == C[0]) else print('NO')

Submission status: Accepted

Solution code:
a, b, c = input().split()

print("YES" if a[-1] == b[0] and b[-1] == c[0] else "NO")

Submission status: Accepted

Solution code:
A, B, C = input().split(" ")

print("YES" if A[-1] == B[0] and B[-1] == C[0] else "NO")

Submission status: Accepted

Solution code:
A, B, C=input().split(" ")
print("YES" if ((A[-1]==B[0])and(B[-1]==C[0])) else "NO")

Submission status: Accepted

Solution code:
a,b,c=input().split();print(" YNEOS"[a[-1]==b[0]and b[-1]==c[0]::2])

Submission status: Accepted

Solution code:
A,B,C=input().split()

if A[-1]==B[0]and B[-1]==C[0]:
    print("YES")
else:
    print("NO")

Submission status: Accepted

Solution code:
a,b,c = input().split()

d = a[-1]
e = b[0]
f=b[-1]
g=c[0]

if (d == e)and(f==g):
    print ("YES")
else:
    print ("NO")

Submission status: Accepted

Solution code:
A,B,C=input().split()
A=str(A)
B=str(B)
c=str(C)
if (A[-1]==B[0]) and (B[-1] == c[0]):
    print ("YES")
else:
    print ("NO")

Submission status: Accepted

Solution code:
a,b,c = input().split()
if (a[-1] == b[0] and b[-1] == c[0]):
    print ("YES")
else:
    print ("NO")

Submission status: Accepted

Solution code:
A, B, C = input().split()
res = "NO"
if A[-1] == B[0] and B[-1] == C[0]:
    res = "YES"

print(res)

Submission status: Accepted

Solution code:
# ABC060a
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**6)

a, b, c = input().split()
print('YNEOS'[a[-1] != b[0] or b[-1] != c[0]::2])

Submission status: Accepted

Solution code:
a,b,c = input().split()

if a[-1:]==b[0] and b[-1:]==c[0]:
  print("YES")
else:
  print("NO")

Submission status: Accepted

Solution code:
from sys import stdin

a,b,c = [x for x in stdin.readline().rstrip().split()]

if a[-1] == b[0] and b[-1] == c[0]:
    print("YES")
else:
    print("NO")

Submission status: Accepted

Solution code:
A,B,C=input().split(" ")

if A[-1]==B[0] and B[-1]==C[0]:
    print("YES")
else:
    print("NO")

Submission status: Accepted

Solution code:
A,B,C = input().split()
if A[-1]==B[0] and B[-1]==C[0]:
    print("YES")
else:
    print("NO")

Submission status: Accepted

Solution code:
a,b,c = map(str,input().split())
if a[-1:]==b[:1] and b[-1:]==c[:1]:
    print("YES")
else:
    print("NO")

Submission status: Accepted

Solution code:
a,b,c=input().split()

if a[-1]==b[0] and b[-1]==c[0]:
    print('YES')
else:
    print('NO')

Submission status: Accepted

Solution code:
a = input().split()

ok = True
for i in range(1,len(a)):
  if a[i-1][-1]==a[i][0]:
    continue
  else:
    ok = False
print("YES" if ok else "NO")

Submission status: Accepted

Solution code:
A,B,C = map(str, input().split())

A_last = (A[-1])
B_first = (B[0]) 
B_last = (B[-1])
C_first = (C[0])

if A_last == B_first and B_last == C_first:
    print("YES")
else:
    print("NO")

Submission status: Accepted

Solution code:
a,b,c= input().split()
print('YES' if a[-1] == b[0] and b[-1] == c[0] else 'NO')

Submission status: Accepted

Solution code:
A,B,C = map(list,input().split())
# Pythonの三項演算子の書き方、結構違和感ある
print('YES') if A[-1] == B[0] and B[-1] == C[0] else print('NO')

Submission status: Accepted

Solution code:
a, b, c = map(str, input().split())
if a[-1] == b[0]:
    if b[-1] == c[0]:
        print('YES')
    else:
        print('NO')
else:
    print('NO')

Submission status: Accepted

Solution code:
A, B, C = input().split()
if A[len(A)-1]==B[0] and B[len(B)-1]==C[0]:
    print('YES')
    exit()
print('NO')

Submission status: Accepted

Solution code:
# atcoder : python3 (3.4.3)
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**6)
mod = 10**9+7

# main
A,B,C = input().split()

print("YES" if A[-1]==B[0] and B[-1]==C[0] else "NO")

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
import math

#入力
A, B, C = map(str, input().split())

if (len(A) == 1) :
  Aend = A
else :
  Aend = A[len(A)-1:len(A)]

if (len(B) == 1) :
  Bstart = B
  Bend = B
else :
  Bstart = B[0:1]
  Bend = B[len(B)-1:len(B)]

Cstart = C[0:1]

if Aend == Bstart and Bend == Cstart :
  print ("YES")
else :
  print ("NO")

Submission status: Accepted

Solution code:
a,b,c=map(str, input().split())
print("YES" if a[-1] == b[0] and b[-1] == c[0] else "NO")

Submission status: Accepted

Solution code:
a,b,c = input().split()
print("YES" if a[-1]==b[0] and b[-1]==c[0] else("NO"))

Submission status: Accepted

Solution code:
#ABC060 A - Shiritori
si = lambda: input()
ni = lambda: int(input())
nm = lambda: map(int, input().split())
nl = lambda: list(map(int, input().split()))
a,b,c = map(str, input().split())
if a[-1]==b[0] and b[-1]==c[0]:
    print('YES')
else:
    print('NO')

Submission status: Accepted

Solution code:
a, b, c = input().split()
if (a[-1] == b[0]) and (b[-1] == c[0]) :
    print("YES")
else :
    print("NO")

Submission status: Accepted

Solution code:
A,B,C = input().split()
print('YES' if A[-1]==B[0] and B[-1]==C[0]  else 'NO')

Submission status: Accepted

Solution code:
def examA():
    A, B, C = LS()
    if A[-1]==B[0] and B[-1]==C[0]:
        ans = "YES"
    else:
        ans = "NO"
    print(ans)

import sys
import copy
import bisect
from collections import Counter,defaultdict,deque
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))
def LS(): return sys.stdin.readline().split()
def S(): return sys.stdin.readline().strip()
mod = 10**9 + 7
inf = float('inf')

examA()

Submission status: Accepted

Solution code:
a,b,c = input().split()

if a[len(a)-1]==b[0] and b[len(b)-1]==c[0]:
	print('YES')
else:
	print('NO')

Submission status: Accepted

Solution code:
a,b,c=map(str, input().split()) 
if a[len(a)-1:len(a)] == b[0:1] and b[len(b)-1:len(b)] == c[0:1]:
    print("YES")
else:
    print("NO")

Submission status: Accepted

Solution code:
S = input().split()

if S[0][len(S[0])-1] != S[1][0] or S[1][len(S[1])-1] != S[2][0]:
    print("NO")
else:
    print("YES")

Submission status: Accepted

Solution code:
a,b,c = map(str,input().split())
if a[-1] == b[0] and b[-1] == c[0]:print("YES")
else:print("NO")

Submission status: Accepted

Solution code:
A , B , C = input().split()

if A[-1] == B[0] and B[-1] == C[0]:
    print("YES")

else:
    print("NO")

Submission status: Accepted

Solution code:
A, B, C = map(str, input().split())
a = list(A)
b = list(B)
c = list(C)
 
if a[-1] == b[0] and b[-1] == c[0]:
  print('YES')
else:
  print('NO')

Submission status: Accepted

Solution code:
a, b, c = map(str,input().split())
if a[-1] == b[0] and b[-1] == c[0]:
	print ("YES")
else:
	print ("NO")

Submission status: Accepted

Solution code:
A,B,C=map(str,input().split())
print('YES' if A[-1]==B[0] and B[-1]==C[0] else'NO')

Submission status: Accepted

Solution code:
a,b,c=input().split()
n=len(a)
m=len(b)
if a[n-1]==b[0] and b[m-1]==c[0]:print('YES')
else:print('NO')

Submission status: Accepted

Solution code:
a,b,c=map(str,input().split())
if a[len(a)-1]==b[0] and b[len(b)-1]==c[0]:
    print("YES")
else:
    print("NO")

Submission status: Accepted

Solution code:
a, b, c = input().split()
if a[-1]==b[0] and b[-1] == c[0]:
    print('YES')
else:
    print('NO')

Submission status: Accepted

Solution code:
#Shiritori
A, B, C = input().split()
if A[-1:] == B[:1]:
    if B[-1:] == C[:1]:
        print("YES")
    else:
        print("NO")
else:
    print("NO")

Submission status: Accepted

Solution code:
a, b, c = map(str, input().split())
if a[-1]==b[0] and b[-1]==c[0]:
  print("YES")
else:
  print("NO")

Submission status: Accepted

Solution code:
a,b,c=map(str,input().split())
aa=list(a)
bb=list(b)
cc=list(c)
if aa[-1]==bb[0] and bb[-1]==cc[0]:
  print("YES")
else:
  print("NO")