For this Question: Newton has a sequence of N words. He wants to make sure that all the words after the first word follow a specific pattern i. e. they should start with letter same as the previous word ending letter and they should not have occurred before.

You are given all the words, tell whether they follow the pattern set by Newton or not. Print "Yes" if they follow, otherwise print "No"The first line of the input consists of an integer N
Each of the next N lines contains a string S<sub>i</sub>

<b>Constraints</b>:
2 <= N <= 10<sup>5</sup>
1 <= |Si| <= 100Output the answer.Sample Input 1:
3
newton
school
discord

Sample Output 1:
No

Explanation:
2nd and 3rd word doesn't start with the previous word ending letter


Sample Input 2:
3
newton
newton
newton

Sample Output 2:
No

Explanation:
Same word "newton" occurring multiple times


Sample Input 3:
3
yash
hsay
yay

Sample Output 3:
Yes, I have written this Solution Code: #include <iostream>
#include <vector>
#include <algorithm>
#include <string>
using namespace std;
int main(){
   int n, i, j;
   vector<string> str;
   string moji;
   char sta, fin;

   cin >> n;
   for(i = 0; i < n; i++){
      cin >> moji;
      str.push_back(moji);
   }

   for(i = 1; i < n; i++){
      for(j = 0; j < i; j++){
         if(str[i] == str[j]){
            cout << "No";
            return 0;
         }
      }
   }

   for(i = 1; i < n; i++){
      sta = str[i][0];
      fin = str[i - 1][str[i - 1].size() - 1];
      if(sta != fin){
         cout << "No";
         return 0;
      }
   }
   cout << "Yes" << endl;
   return 0;
}, In this Programming Language: C++, Now tell me if this Code is compilable or not?