Language: C++

#incimport java.util.*;
class Main{
  public static void main(String[] args){
    Scanner scan=new Scanner(System.in);
    int N=scan.nextInt();
    scan.nextLine();
    String[] W=new String[N];
    for(int i=0;i<N;i++){
      W[i]=scan.nextLine();
    }
    
    for(int i=0;i<N-1;i++){
      for(int j=i+1;j<N;j++){
        if(W[i].equals(W[j])){
          System.out.println("No");
          System.exit(0);
        }
      }
    }
      for(int i=0;i<N-1;i++){
        int j=i+1;
        String A=W[i].substring(W[i].length()-1);
        String B=W[j].substring(0,1);
        String B_end=W[j].substring(W[j].length()-1);
        if(!A.equals(B)){
          System.out.println("No");
          System.exit(0);
        }
      }
      System.out.println("Yes");
    }
  }


Compiler output:
a.cc:1:2: error: invalid preprocessing directive #incimport; did you mean #import?
    1 | #incimport java.util.*;
      |  ^~~~~~~~~
      |  import
a.cc:3:9: error: expected ':' before 'static'
    3 |   public static void main(String[] args){
      |         ^~~~~~~
      |         :
a.cc:3:27: error: 'String' has not been declared
    3 |   public static void main(String[] args){
      |                           ^~~~~~
a.cc:3:36: error: expected ',' or '...' before 'args'
    3 |   public static void main(String[] args){
      |                                    ^~~~
a.cc:32:4: error: expected ';' after class definition
   32 |   }
      |    ^
      |    ;
a.cc: In static member function 'static void Main::main(int*)':
a.cc:4:5: error: 'Scanner' was not declared in this scope
    4 |     Scanner scan=new Scanner(System.in);
      |     ^~~~~~~
a.cc:5:11: error: 'scan' was not declared in this scope
    5 |     int N=scan.nextInt();
      |           ^~~~
a.cc:7:5: error: 'String' was not declared in this scope
    7 |     String[] W=new String[N];
      |     ^~~~~~
a.cc:7:12: error: expected primary-expression before ']' token
    7 |     String[] W=new String[N];
      |            ^
a.cc:9:7: error: 'W' was not declared in this scope
    9 |       W[i]=scan.nextLine();
      |       ^
a.cc:14:12: error: 'W' was not declared in this scope
   14 |         if(W[i].equals(W[j])){
      |            ^
a.cc:15:11: error: 'System' was not declared in this scope
   15 |           System.out.println("No");
      |           ^~~~~~
a.cc:22:16: error: expected ';' before 'A'
   22 |         String A=W[i].substring(W[i].length()-1);
      |                ^
a.cc:23:16: error: expected ';' before 'B'
   23 |         String B=W[j].substring(0,1);
      |                ^
a.cc:24:16: error: expected ';' before 'B_end'
   24 |         String B_end=W[j].substring(W[j].length()-1);
      |                ^~~~~
a.cc:25:13: error: 'A' was not declared in this scope
   25 |         if(!A.equals(B)){
      |             ^
a.cc:25:22: error: 'B' was not declared in this scope
   25 |         if(!A.equals(B)){
      |                      ^
a.cc:26:11: error: 'System' was not declared in this scope
   26 |           System.out.println("No");
      |           ^~~~~~
a.cc:30:7: error: 'System' was not declared in this scope
   30 |       System.out.println("Yes");
      |       ^~~~~~