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()
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 = [elem for elem in 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:
#n = int(input())
#a = int(input())
#ls = list(input().split(" "))
#ls = list(map(int,input().split(" ")))
#a,b,c = list(map(int,input().split(" ")))
a,b,c = list(input().split())
#string = input()

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

Submission status: Accepted

Solution code:
words = input().split()
if words[0][-1] == words[1][0] and words[1][-1] == words[2][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[-1] == b[0]) & (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()
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 = map(str,input().split())

if A[-1] == B[0] and 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:
import sys, re, os
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()))
def S_LIST(): return list(map(str, input().split()))

sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

A, B, C = S_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[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:
line = input()
Line = line.split()
A = Line[0]
B = Line[1]
C = Line[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())
if A[-1]==B[0] and B[-1]==C[0]:
    print("YES")
else:
    print("NO")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
from collections import defaultdict
from collections import deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
import itertools
sys.setrecursionlimit(10**5)
stdin = sys.stdin
bisect_left = bisect.bisect_left
bisect_right = bisect.bisect_right
def LI(): return list(map(int, stdin.readline().split()))
def LF(): return list(map(float, stdin.readline().split()))
def LI_(): return list(map(lambda x: int(x)-1, stdin.readline().split()))
def II(): return int(stdin.readline())
def IF(): return float(stdin.readline())
def LS(): return list(map(list, stdin.readline().split()))
def S(): return list(stdin.readline().rstrip())
def IR(n): return [II() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def FR(n): return [IF() for _ in range(n)]
def LFR(n): return [LI() for _ in range(n)]
def LIR_(n): return [LI_() for _ in range(n)]
def SR(n): return [S() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
mod = 1000000007
inf = float('INF')

#A
def A():
    a, b, c = LS()
    if a[-1] == b[0] and b[-1] == c[0]:
        print("YES")
    else:
        print("NO")
    return

#B
def B():
    return

#C
def C():
    return

#D
def D():
    return

#E
def E():
    return

#F
def F():
    return

#G
def G():
    return

#H
def H():
    return

#Solve
if __name__ == '__main__':
    A()

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:
v = list(input().split(' '))

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

Submission status: Accepted

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

tmp = A[len(A) - 1]
tmp1 = B[0]
tmp2 = B[len(B) - 1]
tmp3 = C[0]

if tmp == tmp1 and tmp2 == tmp3:
    print('YES')
else:
    print('NO')

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
#ABC60 A

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 = (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:
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:
temp_list = [x for x in input().split()]
if temp_list[0][-1] == temp_list[1][0] and temp_list[1][-1] == temp_list[2][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:
A, B, C = map(str,input().split())
out = ("YES" if A[-1]==B[0] and B[-1]==C[0] else "NO")
print(out)

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 = 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:
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()
AL = list(A)
BL = list(B)
CL = list(C)
print("YES" if AL[len(AL)-1] == BL[0] and BL[len(BL)-1] == CL[0] else "NO")

Submission status: Accepted

Solution code:
# A問題
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:
#!/usr/bin/env python3
import sys
sys.setrecursionlimit(300000)

YES = "YES"  # type: str
NO = "NO"  # type: str

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


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    A = next(tokens)  # type: str
    B = next(tokens)  # type: str
    C = next(tokens)  # type: str
    solve(A, B, C)

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

Submission status: Accepted

Solution code:
nl = lambda: list(map(int, input().split()))
sl = lambda: input().split()
n = lambda: int(input())
s = lambda: input()

A, B, C = sl()

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=a[-1]
c=s[1]
d=c[0]
e=c[-1]
f=s[2]
g=f[0]

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:

A, B, C = [str(i) for i in 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])&(b[-1]==c[0]):
  print("YES")
else:
  print("NO")

Submission status: Accepted

Solution code:
# coding: utf-8
# Your code here!

# 両方とも正しいならば YES、そうでないならば NO を出力してください。

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

# print(A)
# print(B)
# print(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(["NO", "YES"][A[-1] == B[0] and B[-1] == C[0]])

Submission status: Accepted

Solution code:
s1, s2, s3 = list(input().split(' '))

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

Submission status: Accepted

Solution code:
# coding: utf-8
# Your code here!

A, B, C = map(str, input().split())
len_A = len(A)
len_B = len(B)
flag = 0

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

if flag == 0:
    print("NO")

Submission status: Accepted

Solution code:
a, b, c = map(str, input().split())
aList = list(a)
bList = list(b)
cList = 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=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:
# https://atcoder.jp/contests/abc060/tasks/abc060_a

import itertools
import collections
import bisect

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:
# coding: utf-8
# Your code here!

A, B, C = map(str, input().split())
len_A = len(A)
len_B = len(B)
flag = 0

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

if flag == 0:
    print("NO")

Submission status: Accepted

Solution code:
A, B, C = list(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 B[0] == A[(len(A)-1):] 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 = input().split()
if a[-1] in b[0] and b[-1] in c[0]:
    ans = 'YES'
else:
    ans = 'NO'
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:
def abc():
    a, b, c = input().split()
    if a[-1] == b[0] and b[-1] == c[0]:
        print('YES')
    else:
        print('NO')


abc()

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:
# -*- 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 = list(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 = [x for x in 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:
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(' ')

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()
answer = 'NO'

if a[-1] == b[0]:
    if b[-1] == c[0]:
        answer = 'YES'

print(answer)

Submission status: Accepted

Solution code:
###template###
import sys
def input(): return sys.stdin.readline().rstrip()
def mi(): return map(int, input().split())
###template###

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:
x,y,z=input().split()
print("YES" if x[-1]==y[0] and y[-1]==z[0] else "NO")

Submission status: Accepted

Solution code:
s1, s2, s3 = [ v for v in input().split() ]

if s1[-1] == s2[0] and s2[-1] == s3[0]:
  ans = "YES"
else:
  ans = "NO"
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:
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 = map(str, input().split())
print('YES' if A[-1] == B[0] and B[-1] == C[0] else 'NO')

Submission status: Accepted

Solution code:
# 入力
# スペース区切りの整数の入力(未知数)
list_s = [string for string in input().split()]

# 計算と出力
if (list_s[0][-1] == list_s[1][0]) and (list_s[1][-1] == list_s[2][0]) :
    print("YES")
else :
    print("NO")

Submission status: Accepted

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

if a[-1:]==b[0:1] and b[-1:]==c[0: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,b,c=input().split();print('NYOE S'[a[-1]==b[0]and b[-1]==c[0]::2])

Submission status: Accepted

Solution code:
l = 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[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:
a,b,c=[i for i in input().split()]
l1=len(a)
l2=len(b)
l3=len(c)
if a[l1-1]==b[0] and b[l2-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:
# encoding:utf-8
import copy
import random
import bisect #bisect_left　これで二部探索の大小検索が行える
import fractions #最小公倍数などはこっち
import math

mod = 10**9+7

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("YNEOS"[a[-1]!=b[0] or b[-1]!=c[0]::2])

Submission status: Accepted

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

current = ''
for word in words:
    if current == '':
        current = word
        continue

    if current[-1] == word[0]:
        current = word
    else:
        print('NO')
        break
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=input().split()
print("YNEOS"[A[-1]!=B[0]or B[-1]!=C[0]::2])

Submission status: Accepted

Solution code:
import sys

input = sys.stdin.readline


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

    print(ans)


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
lis=list(input().split())
if lis[0][-1]==lis[1][0] and lis[1][-1]==lis[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:
#N = int(input())
#A = [int(x) for x in input().split()]
#a, b, c = map(int, input().split())
#name1 = str(input())
#alph = {"A": 1, "B": 2, "C": 3, "D": 4, "E": 5}
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 Shiritori(x,y,z):

    len_x = len(x)
    len_y = len(y)
    len_z = len(z)

    if x[len_x-1] == y[0]:
        if y[len_y - 1] == z[0]:
            return "YES"
        else:
            return "NO"
    else:
            return "NO"

A,B,C=map(str,input().rstrip().split(' '))

FLAG = Shiritori(A,B,C)

print(FLAG)

Submission status: Accepted

Solution code:
A,B,C = map(list,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:
Nstr = input().split()
result = 'YES'
for i in range(2):
    if Nstr[i][-1] != Nstr[i + 1][0]:
        result = 'NO'
print(result)

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();print("YNEOS"[a[-1]!=b[0] or b[-1]!=c[0]::2])

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 print('NO')

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

Submission status: Accepted

Solution code:

def read_input():
    a, b, c = input().strip().split()
    return a, b, c

def submit():
    a, b, c = read_input()

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



if __name__ == '__main__':
    submit()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#ABC060A
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:
w=input().split()
if w[0][-1]==w[1][0] and w[1][-1]==w[2][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")

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

Submission status: Accepted

Solution code:
import sys
a,b,c = list(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:
A, B, C = list(input().split())

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

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 = 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:
[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:
import sys, os
import numpy as np

f = lambda:list(map(int,input().split()))
if 'local' in os.environ :
    sys.stdin = open('./input.txt', 'r')

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

solve()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import functools

import os

INF = float('inf')


def inp():
    return int(input())


def inpf():
    return float(input())


def inps():
    return input()


def inl():
    return list(map(int, input().split()))


def inlf():
    return list(map(float, input().split()))


def inls():
    return input().split()


def inpm(line):
    return [inp() for _ in range(line)]


def inpfm(line):
    return [inpf() for _ in range(line)]


def inpsm(line):
    return [inps() for _ in range(line)]


def inlm(line):
    return [inl() for _ in range(line)]


def inlfm(line):
    return [inlf() for _ in range(line)]


def inlsm(line):
    return [inls() for _ in range(line)]


def debug(fn):
    if not os.getenv('LOCAL'):
        return fn

    @functools.wraps(fn)
    def wrapper(*args, **kwargs):
        print('DEBUG: {}({}) -> '.format(
            fn.__name__,
            ', '.join(
                list(map(str, args)) +
                ['{}={}'.format(k, str(v)) for k, v in kwargs.items()]
            )
        ), end='')
        ret = fn(*args, **kwargs)
        print(ret)
        return ret

    return wrapper

a, b, c = inls()

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s1,s2,s3=map(str,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 = [item for item 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())
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 = input().split()
print('YES') if a[-1] == b[0] and b[-1] == c[0] 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:
from functools import reduce
import math

def main():
    # 文字列の2進数を数値にする
    # '101' → '5'
    # 文字列の頭に'0b'をつけてint()にわたす
    # binary = int('0b'+'101',0)

    # 2進数で立っているbitを数える
    # 101(0x5) → 2
    # cnt_bit = bin(5).count('1')
    
    # N! を求める
    # f = math.factorial(N)
    
    # 切り捨て
    # 4 // 3
    # 切り上げ
    #-(-4 // 3)
    
    # 初期値用:十分大きい数(100億)
    # 1e10

    # 初期値用:十分小さい数(-100億)
    # -1e10
    
    # 1文字のみを読み込み
    # 入力:2
    # a = input().rstrip()
    # 変数:a='2'
    
    # スペース区切りで標準入力を配列として読み込み
    # 入力:2 4 5 7
    # a, b, c, d = (int(_) for _ in input().split())  
    # 変数:a=2 b=4 c=5 d =7
    
    # 1文字ずつ標準入力を配列として読み込み
    # 入力:2 4 5 7
    # a = list(int(_) for _ in input().split())
    # 変数:a = [2, 4, 5, 7]    

    # 1文字ずつ標準入力を配列として読み込み
    # 入力:2457
    # a = list(int(_) for _ in input())
    # 変数:a = [2, 4, 5, 7]    
    a, b, c = (_ for _ in 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:
s,t,u=map(str,input().split())
if s[-1]==t[0] and t[-1]==u[0]:
  print('YES')
else:
  print('NO')

Submission status: Accepted

Solution code:
A,B,C=input().split();print('YNEOS'[(A[-1]!=B[0])|(B[-1]!=C[0])::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 = input().split()

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

Submission status: Accepted

Solution code:
import sys

def main():
    input = sys.stdin.readline
    A, B, C = map(str, input().split())

    if A[-1] == B[0] and B[-1] == C[0]:
        return 'YES'
    else:
        return 'NO'


if __name__ == '__main__':
    print(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:
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 = 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 INSTR():
	return input()

def INNUM():
	return int(INSTR())

def INSTR_S():
	return INSTR().split()

def INNUM_S():
	return map(int, INSTR_S())

def INSTR_SM(n):
	return [tuple(INSTR_S()) for _ in range(n)]

def INNUM_SM(n):
	return [tuple(INNUM_S()) for _ in range(n)]

A, B, C = INSTR_S()
print("YNEOS"[not(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]) & (b[-1] == c[0]):
    print("YES")
else:
    print("NO")

Submission status: Accepted

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

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:
s = input().split();print("YNEOS"[(s[0][-1]!=s[1][0] or s[1][-1]!=s[2][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=input().split()
for i in range(1,3):
    if a[i-1][-1] != a[i][0]:
        print('NO')
        exit()
print('YES')