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:
import sys
import math
import collections
import itertools
import array
import inspect

# Set max recursion limit
sys.setrecursionlimit(1000000)


# Debug output
def chkprint(*args):
    names = {
        id(v): k
        for k, v in inspect.currentframe().f_back.f_locals.items()
    }
    print(', '.join(
        names.get(id(arg), '???') + ' = ' + repr(arg) for arg in args))


# Binary converter
def to_bin(x):
    return bin(x)[2:]


def li_input():
    return [int(_) for _ in input().split()]


def gcd(n, m):
    if n % m == 0:
        return m
    else:
        return gcd(m, n % m)


def gcd_list(L):
    v = L[0]

    for i in range(1, len(L)):
        v = gcd(v, L[i])

    return v


def lcm(n, m):
    return (n * m) // gcd(n, m)


def lcm_list(L):
    v = L[0]

    for i in range(1, len(L)):
        v = lcm(v, L[i])

    return v


# Width First Search (+ Distance)
def wfs_d(D, N, K):
    """
    D: 隣接行列(距離付き)
    N: ノード数
    K: 始点ノード
    """

    dfk = [-1] * (N + 1)
    dfk[K] = 0

    cps = [(K, 0)]
    r = [False] * (N + 1)
    r[K] = True
    while len(cps) != 0:
        n_cps = []
        for cp, cd in cps:
            for i, dfcp in enumerate(D[cp]):
                if dfcp != -1 and not r[i]:
                    dfk[i] = cd + dfcp
                    n_cps.append((i, cd + dfcp))
                    r[i] = True

        cps = n_cps[:]

    return dfk


# Depth First Search (+Distance)
def dfs_d(v, pre, dist):
    """
    v:  現在のノード
    pre: １つ前のノード
    dist: 現在の距離

    以下は別途用意する
    D: 隣接リスト(行列ではない)
    D_dfs_d: dfs_d関数で用いる，始点ノードから見た距離リスト
    """

    global D
    global D_dfs_d

    D_dfs_d[v] = dist

    for next_v, d in D[v]:
        if next_v != pre:
            dfs_d(next_v, v, dist + d)

    return


def sigma(N):
    ans = 0
    for i in range(1, N + 1):
        ans += i
    return ans


def comb(n, r):
    if n - r < r: r = n - r
    if r == 0: return 1
    if r == 1: return n

    numerator = [n - r + k + 1 for k in range(r)]
    denominator = [k + 1 for k in range(r)]

    for p in range(2, r + 1):
        pivot = denominator[p - 1]
        if pivot > 1:
            offset = (n - r) % p
            for k in range(p - 1, r, p):
                numerator[k - offset] /= pivot
                denominator[k] /= pivot

    result = 1
    for k in range(r):
        if numerator[k] > 1:
            result *= int(numerator[k])

    return result

def bisearch(L, target):
    low = 0
    high = len(L) - 1
    
    while low <= high:
        mid = (low + high) // 2
        guess = L[mid]
        if guess == target:
            return True
        elif guess < target:
            low = mid + 1
        elif guess > target:
            high = mid - 1
    if guess != target:
        return False

# --------------------------------------------

dp = None


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


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:
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
f= input().split()
if f[0][-1:]== f[1][:1] and  f[1][-1:]== f[2][:1]:
  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 = 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()
if a[-1] != b[0]:
  ans = 'NO'
elif b[-1] != c[0]:
  ans = 'NO'
else:
  ans = 'YES'
print(ans)

Submission status: Accepted

Solution code:
a,b,c = map(str,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:
A, B, C=input().split()
print("YES" if A[-1]==B[0] and B[-1]==C[0] else "NO")

Submission status: Accepted

Solution code:
x,y,z=input().split()
#print(x[-1])
#print(y[0])
if x[-1]==y[0] and y[-1]==z[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(list,input().split())
print("YNEOS"[a[-1]!=b[0]or b[-1]!=c[0]::2])

Submission status: Accepted

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

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 = 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:
# -*- coding: utf-8 -*-

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 = map(str,input().split())
print(["NO","YES"][a[-1]==b[0] and b[-1]==c[0]])

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#60a
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 = [s for s in input().split()]
ans = "NO"

if A[-1] == B[0] and B[-1] == C[0]:
    ans = "YES"

print(ans)

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:
#-*-coding:utf-8-*-

def main():
    a, b, c = input().split()

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

if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s1,s2,s3 = 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 = map(list, input().split())
if a[-1] == b[0] and b[-1] == c[0]:
    print("YES")
else:
    print("NO")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
A,B,C=(i for i in 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 = (i for i in input().split())

a = A[-1]
b = B[0]
bb = B[-1]
c = C[0]

if a == b and bb == c:
    print("YES")
else:
    print("NO")

Submission status: Accepted

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

a = A[len(A)-1]
b = B[0]
bb = B[len(B)-1]
c = C[0]

if a == b and bb == c:
    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[len(a)-1]==b[0] and b[len(b)-1]==c[0]:
    print("YES")
else:
    print("NO")

Submission status: Accepted

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

Submission status: Accepted

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

if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

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

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()
A = list(str(a))
B = list(str(b))
C = list(str(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:
# -*- coding: utf-8 -*-

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:
# input
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[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]=[i for i in 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 = raw_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(("NO","YES")[a[-1]==b[0]and b[-1]==c[0]])

Submission status: Accepted

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

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[:1] and b[-1] == c[:1] 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[-1]==b[0] and b[-1]==c[0]) else 'NO')

Submission status: Accepted

Solution code:
a,b,c = [str for str in 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=[i for i in 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:
a, b, c = [i for i in 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(["NO","YES"][A[-1]is B[0] and B[-1]is C[0]])

Submission status: Accepted

Solution code:
s1,s2,s3=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()
print(('NO','YES')[a[-1]==b[0] and b[-1]==c[0]])

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[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:
# -*- coding: utf-8 -*-

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()
print(["NO","YES"][a[-1]==b[0]and b[-1]==c[0]])

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:
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 = 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[len(A)-1]==B[0] and B[len(B)-1]==C[0]:
    print ('YES')
else:
    print ('NO')

Submission status: Accepted

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

a, b, c = raw_input().split()
print shiritori(a, b, c)

Submission status: Accepted

Solution code:
ina,inb,inc = input().split()
if ina[-1] == inb[0] and inb[-1] == inc[0]:
  print("YES")
else:
  print("NO")

Submission status: Accepted

Solution code:
a,b,c=(str(i) for i in 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:
N = input().split()

if N[0][-1]==N[1][0] and N[1][-1]==N[2][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:
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 = 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:
a,b,c=input().split()
A=len(a)
B=len(b)
if a[(A-1)]==b[0]:
    if b[(B-1)]==c[0]:
        print("YES")
    else :
        print("NO")
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 math
import sys

def getinputdata():

    # 配列初期化
    array_result = []
    
    data = input()

    
    array_result.append(data.split(" "))

    flg = 1

    try:

        while flg:

            data = input()

            array_temp = []

            if(data != ""):
                
                array_result.append(data.split(" "))

                flg = 1

            else:

                flg = 0
    finally:


        return array_result

arr_data = getinputdata()

a = arr_data[0][0]
b = arr_data[0][1]
c = arr_data[0][2]


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

Submission status: Accepted

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

# AtCoder Beginner Contest
# Problem A

if __name__ == '__main__':
    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 = (i for i in 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[len(a)-1]==b[0] and b[len(b)-1]==c[0] else 'NO')

Submission status: Accepted

Solution code:
a,b,c=input().split()
s=[a,b,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()
print('YES' if a[-1]==b[0] and b[-1]==c[0] else 'NO')

Submission status: Accepted

Solution code:
# coding: utf-8
# Your code here!
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()
alen = len(a)
blen = len(b)
clen = len(c)
if a[alen-1] == b[0] and b[blen-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 = raw_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 = [i for i in input().strip().split()]
if A[-1]==B[0] and B[-1]==C[0]:
  print('YES')
else:
  print('NO')

Submission status: Accepted

Solution code:
s = str(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:
# -*- coding: utf-8 -*-
"""
https://abc060.contest.atcoder.jp/tasks/abc060_a

"""
import sys
from sys import stdin
input = stdin.readline


def solve(A, B, C):
    ans = 'NO'
    if A[-1] == B[0] and B[-1] == C[0]:
        ans = 'YES'
    return ans


def main(args):
    A, B, C = input().strip().split()
    ans = solve(A, B, C)
    print(ans)


if __name__ == '__main__':
    main(sys.argv[1:])

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:
l = map(str, raw_input().split())
for i in range(len(l)-1):
    tempa = list(l[i])
    tempb = list(l[i+1])
    if tempa[len(tempa)-1] != tempb[0]:
        print "NO"
        exit(0)
print "YES"

Submission status: Accepted

Solution code:
# coding: utf-8
# Your code here!
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 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:
def main():
    A, B, C = input().split()

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

if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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


solve()

Submission status: Accepted

Solution code:
n = raw_input().split()
print 'YES' if n[0][-1] == n[1][0] and n[1][-1] == n[2][0] else '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:
#!/ust/bin/env python

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:
val = input().split()

if val[0][len(val[0])-1] == val[1][0] and val[1][len(val[1])-1] == val[2][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 = 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())
lst1 = list(A)
lst2 = list(B)
lst3 = list(C)
if lst1[-1] ==lst2[0] and lst2[-1] == lst3[0]:
    print("YES")
else:
    print("NO")

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
a,b,c = raw_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[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:
ls = list(map(str, input().split()))
if ls[0][-1] == ls[1][0] and ls[1][-1] == ls[2][0]:
    print('YES')
else:
    print('NO')

Submission status: Accepted

Solution code:

s,y,j=input().split()

ss=len(s)
yy=len(y)
jj=len(j)
nyan=0
if s[ss-1:ss]==y[0:1]:
    nyan+=1
    
if y[yy-1:yy]==j[0:1]:
    nyan+=1
    
    
if nyan==2:
    print('YES')
else:
    print('NO')

Submission status: Accepted

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

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

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, raw_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 = [i for i in 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(["NO","YES"][a[-1]==b[0]and b[-1]==c[0]])

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def read_str_list():
    return list(str(s) for s in input().split())

a,b,c = read_str_list()
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:
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=[x for x in input().split()]
if a[-1]==b[0] and b[-1]==c[0]:
    print("YES")
else:
    print("NO")

Submission status: Accepted

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

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


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
A,B,C=[i for i in 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")
else:
    print("NO")

Submission status: Accepted

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

X = False
if A[-1]==B[0]:
    if B[-1] == C[0]:
        X = True

if X:
    print('YES')
else:
    print('NO')

Submission status: Accepted

Solution code:
input_line = raw_input().split(" ")
a = input_line[0]
b = input_line[1]
c = input_line[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:
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

import sys
import re
import math
import collections
import itertools
import functools

DEBUG = True
DEBUG = False

def dbg(*args):
    if DEBUG:
        print("DBG: ", file=sys.stderr, end="")
        print(*args, file=sys.stderr)



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

if __name__ == "__main__": main()

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:
strs = input().split()
if strs[0][-1] == strs[1][0] and strs[1][-1] == strs[2][0]:
    print('YES')
else:
    print('NO')

Submission status: Accepted

Solution code:
from collections import defaultdict


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


if __name__ == '__main__':
    main()

Submission status: Accepted

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


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

    elif b[-1] != c[0]:
        print("NO")

elif a[-1] != b[0]:
    print("NO")

Submission status: Accepted

Solution code:
if __name__ == "__main__":
    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:
l = list(map(str, input().split()))


if (l[0][-1] == l[1][0]) and (l[1][-1] == l[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:
s = input().split()
ans = "YES"
a = s[0][-1]
for i in s[1:]:
    if i[0] != a:
        ans = "NO"
    else:
        a = i[-1]
print(ans)

Submission status: Accepted

Solution code:
#Shiritori
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 = raw_input().split()
print 'YES' if A[-1] == B[0] and B[-1] == C[0] else 'NO'

Submission status: Accepted

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

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()

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:
mo=input()
list=mo.split()
a=str(list[0])
b=str(list[1])
c=str(list[2])
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=map(str,raw_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_arr = list(a)
a_tail = a_arr[-1]

b_arr = list(b)
b_head = b_arr[0]
b_tail = b_arr[-1]

c_arr = list(c)
c_head = c_arr[0]

if a_tail == b_head:
   if b_tail == c_head:
      print("YES")
   else:
      print("NO")
else:
   print("NO")

Submission status: Accepted

Solution code:
A,B,C=raw_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]:
    if B[-1] == C[0]:
        print("YES")
    else:
        print("NO")
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] is b[0]) and (b[-1] is 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:
def solve():
    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")

if __name__ == "__main__":
    solve()

Submission status: Accepted

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

result = True
for i in range(len(input_list) - 1):
    result = result and (input_list[i][-1] == input_list[i+1][0])

if result:
    print("YES")
else:
    print("NO")

Submission status: Accepted

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

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 = [i for i in input().split()]

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

Submission status: Accepted

Solution code:
def solve():
  ar = raw_input().split(' ')
  A = ar[0]
  B = ar[1]
  C = ar[2]
  if A[-1] == B[0] and B[-1] == C[0] : return 'YES'
  else: return 'NO'

if __name__ == '__main__' :
  print solve()