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, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, log2
from itertools import accumulate, permutations, combinations, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
import numpy as np
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(str, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7
 
S = LIST()


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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
import itertools
sys.setrecursionlimit(1000000000)
from heapq import heapify,heappop,heappush,heappushpop
import math
import collections
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 = input().split()

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

Submission status: Accepted

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

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=input().split()
a1=len(a)
b1=len(b)
if a[a1-1]==b[0] and b[b1-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=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())
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()
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,s,d=input().split()
print("YES") if a[-1]==s[0]and s[-1]==d[0] else print("NO")

Submission status: Accepted

Solution code:
a=[i for i in 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:
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]:
    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[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
sys.setrecursionlimit(10**7)
from collections import Counter, deque
from collections import defaultdict
from itertools import combinations, permutations, accumulate, groupby, product
from bisect import bisect_left,bisect_right
from heapq import heapify, heappop, heappush
from math import floor, ceil
from operator import itemgetter
def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))
def LI2(): return [int(input()) for i in range(n)]
def MXI(): return [[LI()]for i in range(n)]
inf = 10**17
mod = 10**9 + 7

L=input().rstrip().split(" ")
a=L[0]
b=L[1]
c=L[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()))

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 = 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:
str = input()

a = str.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:

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


if '__main__' == __name__:
    resolve()

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

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

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[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]==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())
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()

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

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[:1] and B[-1:] == C[:1]:
    print("YES")
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]:
  ans = "YES"
else:
  ans = "NO"
print(ans)

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:
s = list(map(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:
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:
icase=0    
if icase==0:
    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 = 'YES' if A[-1] == B[0] and B[-1] == C[0] else 'NO'
print(ans)

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

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

Submission status: Accepted

Solution code:
n, m, k = input().split()
if n[len(n)-1] == m[0] and m[len(m)-1] == k[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=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()
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[-1]==b[0]+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:
l = list(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:
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()
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:
import sys
import os

ii = lambda: int(sys.stdin.buffer.readline().rstrip())
il = lambda: list(map(int, sys.stdin.buffer.readline().split()))
fl = lambda: list(map(float, sys.stdin.buffer.readline().split()))
iln = lambda n: [int(sys.stdin.buffer.readline().rstrip()) for _ in range(n)]

iss = lambda: sys.stdin.buffer.readline().decode().rstrip()
sl = lambda: list(map(str, sys.stdin.buffer.readline().decode().split()))
isn = lambda n: [sys.stdin.buffer.readline().decode().rstrip() for _ in range(n)]


def main():
    if os.getenv("LOCAL"):
        sys.stdin = open("input.txt", "r")

    A, B, C = sl()
    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()
a,b=len(A),len(B)
if(A[a-1]==B[0] and B[b-1]==C[0]):
    print("YES")
else:
    print("NO")

Submission status: Accepted

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

Submission status: Accepted

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

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:
# 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:
#n=int(input())
a,b,c=map(str,input().split())
#al=list(map(int,input().split()))
#l=[list(map(int,input().split())) for i in range(m)]

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

Submission status: Accepted

Solution code:
def main():
  s1,s2,s3 = map(str,input().split())
  ans = False
  if s1[len(s1)-1] == s2[0]:
    if s2[len(s2)-1]==s3[0]:
      ans = True
  print("YES" if ans else "NO")
if __name__ == '__main__':
  main()

Submission status: Accepted

Solution code:
# https://atcoder.jp/contests/abc060/tasks/abc060_a

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[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:
import sys

s = sys.stdin.readline().split()

def main():
    ans = 'YES'
    for i in range(2):
        if s[i][-1] != s[i+1][0]:
            ans = 'NO'
            break
    print(ans)

if __name__ ==  '__main__':
    main()

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
# ABC 060: A – Shiritori
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 = 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())
r = 'YES' if a[-1] == b[0] and b[-1] == c[0] else 'NO'
print(r)

Submission status: Accepted

Solution code:
def ii():return int(input())
def iim():return map(int,input().split())
def iil():return list(map(int,input().split()))
def ism():return map(str,input().split())
def isl():return list(map(str,input().split()))

a,b,c = ism()

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:
import sys
import copy
import math
import bisect
import pprint
import bisect
from functools import reduce
from copy import deepcopy
from collections import deque

if __name__ == '__main__':
    a = [str(i) for i in 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:
A, B, C = input().split()

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

Submission status: Accepted

Solution code:
A = list(input().split())
for i in range(2):
  if A[i][-1] != A[i + 1][0]:
    print('NO')
    exit()
print('YES')

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())
a=list(A)
b=list(B)
c=list(C)
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=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())
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 B[0] == A[len(A) - 1] and C[0] == B[len(B) - 1]:
  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())
x=len(A)
y=len(B)
if A[x-1]==B[0] and B[y-1]==C[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:
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())

flag = False

if a[-1] == b[0]:
  if b[-1] == c[0]:
    flag = True

if flag == True:
  print("YES")
else:
  print("NO")

Submission status: Accepted

Solution code:
a=input()
a=a.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:
# Author: cr4zjh0bp
# Created: Mon Mar 23 19:34:20 UTC 2020
import sys
 
stdin = sys.stdin
inf = 1 << 60
mod = 1000000007
 
ni      = lambda: int(ns())
nin     = lambda y: [ni() for _ in range(y)]
na      = lambda: list(map(int, stdin.readline().split()))
nan     = lambda y: [na() for _ in range(y)]
nf      = lambda: float(ns())
nfn     = lambda y: [nf() for _ in range(y)]
nfa     = lambda: list(map(float, stdin.readline().split()))
nfan    = lambda y: [nfa() for _ in range(y)]
ns      = lambda: stdin.readline().rstrip()
nsn     = lambda y: [ns() for _ in range(y)]
ncl     = lambda y: [list(ns()) for _ in range(y)]
nas     = lambda: stdin.readline().split()

a, b, c = nas()

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

Submission status: Accepted

Solution code:
#060_A
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=list(map(str, input().split()))
a=['']*3
b=['']*10
tmp1=''
tmp2=''
p=0
for i in range(3):
    a[i]=list(A[i])
    if i!=0:
        tmp2=a[i][0]
    if tmp1!='':
        if tmp1!=tmp2:
            p=1
    a[i]=list(reversed(a[i]))
    b=list(a[i])
    tmp1=b[0]
if p==0:
    print('YES')
else:
    print('NO')

Submission status: Accepted

Solution code:
import math

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

Submission status: Accepted

Solution code:
a = [x for x in 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 = 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:
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:
#ABC060.A
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
import sys, math, itertools, collections, bisect
input = lambda: sys.stdin.buffer.readline().rstrip().decode('utf-8')
inf = float('inf') ;mod = 10**9+7
mans = 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:
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())
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=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[-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[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[-1]==b[0] and b[-1]==c[0]:
  print("YES")
else:
  print("NO")

Submission status: Accepted

Solution code:
#abc060 a
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=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[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]:
    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[-1] == B[0] and B[-1]==C[0]:
  print('YES')
else:
  print('NO')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# A - Shiritori
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())
print('YES' if a[len(a)-1] == b[0] and b[len(b)-1] == c[0] else 'NO')

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
import sys


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


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


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().strip().split()

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

Submission status: Accepted

Solution code:


def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))

def main():
    mod=10**9+7
    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()
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
# 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=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[len(a)-1]==b[0] and b[len(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]:
    ans="YES"
else:
    ans="NO"
print(ans)

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


def read_values():
    return map(int, input().split())


def read_list():
    return list(read_values())


def func(N, mod):
    F = [1]
    for i in range(1, N + 1):
        F.append(F[-1] * i % mod)
    return F


def inv(a, mod):
    return pow(a, mod - 2, mod)


def C(F, a, b, mod):
    return F[a] * inv(F[b], mod) * inv(F[a - b], mod) % mod


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


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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# A
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 -*-

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:
a,b,c = input().split()
a_len=len(a)
b_len=len(b)

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