Language: C++

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

class Program
{
    static void Main(string[] args)
    {
        string[] str = Console.ReadLine().Split(' ');
        int lengtha = str[0].Length;
        int lengthb = str[1].Length;
        string end_a = str[0].Substring(lengtha - 1, 1);
        string start_b = str[1].Substring(0, 1);
        string end_b = str[1].Substring(lengthb - 1, 1);
        string start_c = str[2].Substring(0, 1);

        if(end_a == start_b && end_b == start_c){
            Console.WriteLine("YES");
        }else{
            Console.WriteLine("NO");
        }
    }
}

Compiler output:
a.cc:1:7: error: expected nested-name-specifier before 'System'
    1 | using System;
      |       ^~~~~~
a.cc:2:7: error: expected nested-name-specifier before 'System'
    2 | using System.Collections.Generic;
      |       ^~~~~~
a.cc:3:7: error: expected nested-name-specifier before 'System'
    3 | using System.Linq;
      |       ^~~~~~
a.cc:4:7: error: expected nested-name-specifier before 'System'
    4 | using System.Text;
      |       ^~~~~~
a.cc:8:22: error: 'string' has not been declared
    8 |     static void Main(string[] args)
      |                      ^~~~~~
a.cc:8:31: error: expected ',' or '...' before 'args'
    8 |     static void Main(string[] args)
      |                               ^~~~
a.cc:24:2: error: expected ';' after class definition
   24 | }
      |  ^
      |  ;
a.cc: In static member function 'static void Program::Main(int*)':
a.cc:10:9: error: 'string' was not declared in this scope
   10 |         string[] str = Console.ReadLine().Split(' ');
      |         ^~~~~~
a.cc:10:16: error: expected primary-expression before ']' token
   10 |         string[] str = Console.ReadLine().Split(' ');
      |                ^
a.cc:11:23: error: 'str' was not declared in this scope; did you mean 'std'?
   11 |         int lengtha = str[0].Length;
      |                       ^~~
      |                       std
a.cc:13:16: error: expected ';' before 'end_a'
   13 |         string end_a = str[0].Substring(lengtha - 1, 1);
      |                ^~~~~
a.cc:14:16: error: expected ';' before 'start_b'
   14 |         string start_b = str[1].Substring(0, 1);
      |                ^~~~~~~
a.cc:15:16: error: expected ';' before 'end_b'
   15 |         string end_b = str[1].Substring(lengthb - 1, 1);
      |                ^~~~~
a.cc:16:16: error: expected ';' before 'start_c'
   16 |         string start_c = str[2].Substring(0, 1);
      |                ^~~~~~~
a.cc:18:12: error: 'end_a' was not declared in this scope
   18 |         if(end_a == start_b && end_b == start_c){
      |            ^~~~~
a.cc:18:21: error: 'start_b' was not declared in this scope
   18 |         if(end_a == start_b && end_b == start_c){
      |                     ^~~~~~~
a.cc:18:32: error: 'end_b' was not declared in this scope
   18 |         if(end_a == start_b && end_b == start_c){
      |                                ^~~~~
a.cc:18:41: error: 'start_c' was not declared in this scope; did you mean 'static'?
   18 |         if(end_a == start_b && end_b == start_c){
      |                                         ^~~~~~~
      |                                         static
a.cc:19:13: error: 'Console' was not declared in this scope
   19 |             Console.WriteLine("YES");
      |             ^~~~~~~
a.cc:21:13: error: 'Console' was not declared in this scope
   21 |             Console.WriteLine("NO");
      |             ^~~~~~~